GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Iterate over entrySet of j.u.Map instead of keySet + get · functionaljava/functionaljava@7790a18

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • core/src/main/java/fj/data
    • HashMap.java
  • quickcheck/src/main/java/fj/test
    • Arbitrary.java
    • Coarbitrary.java
    • Shrink.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎core/src/main/java/fj/data/HashMap.java‎

Copy file name to clipboardExpand all lines: core/src/main/java/fj/data/HashMap.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public HashMap(final Equal<K> e, final Hash<K> h) {
6363

6464
public HashMap(java.util.Map<K, V> map, final Equal<K> e, final Hash<K> h) {
6565
this(e, h);
66-
for (K key : map.keySet()) {
67-
set(key, map.get(key));
66+
for (Map.Entry<K, V> entry : map.entrySet()) {
67+
set(entry.getKey(), entry.getValue());
6868
}
6969
}
7070

Collapse file

‎quickcheck/src/main/java/fj/test/Arbitrary.java‎

Copy file name to clipboardExpand all lines: quickcheck/src/main/java/fj/test/Arbitrary.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,8 @@ public static <A> Arbitrary<PriorityQueue<A>> arbPriorityQueue(final Arbitrary<A
928928
arbitrary(arbHashtable(arbString, arbString).gen.map(ht -> {
929929
final Properties p = new Properties();
930930

931-
for (final String k : ht.keySet()) {
932-
p.setProperty(k, ht.get(k));
931+
for (final Map.Entry<String, String> entry : ht.entrySet()) {
932+
p.setProperty(entry.getKey(), entry.getValue());
933933
}
934934

935935
return p;
Collapse file

‎quickcheck/src/main/java/fj/test/Coarbitrary.java‎

Copy file name to clipboardExpand all lines: quickcheck/src/main/java/fj/test/Coarbitrary.java
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.util.LinkedHashMap;
3434
import java.util.LinkedHashSet;
3535
import java.util.LinkedList;
36+
import java.util.Map;
3637
import java.util.PriorityQueue;
3738
import java.util.Properties;
3839
import java.util.Stack;
@@ -647,8 +648,8 @@ public static <K, V> Coarbitrary<Hashtable<K, V>> coarbHashtable(final Coarbitra
647648
public <B> Gen<B> coarbitrary(final Hashtable<K, V> h, final Gen<B> g) {
648649
List<P2<K, V>> x = nil();
649650

650-
for (final K k : h.keySet()) {
651-
x = x.snoc(p(k, h.get(k)));
651+
for (final Map.Entry<K, V> entry : h.entrySet()) {
652+
x = x.snoc(p(entry.getKey(), entry.getValue()));
652653
}
653654

654655
return coarbList(coarbP2(ck, cv)).coarbitrary(x, g);
Collapse file

‎quickcheck/src/main/java/fj/test/Shrink.java‎

Copy file name to clipboardExpand all lines: quickcheck/src/main/java/fj/test/Shrink.java
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import java.util.LinkedHashMap;
5757
import java.util.LinkedHashSet;
5858
import java.util.LinkedList;
59+
import java.util.Map;
5960
import java.util.PriorityQueue;
6061
import java.util.Properties;
6162
import java.util.Stack;
@@ -411,8 +412,8 @@ public static <K, V> Shrink<Hashtable<K, V>> shrinkHashtable(final Shrink<K> sk,
411412
}, h -> {
412413
List<P2<K, V>> x = List.nil();
413414

414-
for (final K k : h.keySet()) {
415-
x = x.snoc(p(k, h.get(k)));
415+
for (final Map.Entry<K, V> entry : h.entrySet()) {
416+
x = x.snoc(p(entry.getKey(), entry.getValue()));
416417
}
417418

418419
return x;
@@ -478,8 +479,8 @@ public static <A> Shrink<PriorityQueue<A>> shrinkPriorityQueue(final Shrink<A> s
478479
.map(h -> {
479480
final Properties p = new Properties();
480481

481-
for (final String k : h.keySet()) {
482-
p.setProperty(k, h.get(k));
482+
for (final Map.Entry<String, String> entry : h.entrySet()) {
483+
p.setProperty(entry.getKey(), entry.getValue());
483484
}
484485

485486
return p;

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.