File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -124,11 +124,7 @@ public void forEach(Consumer<T> o) {
124
124
public ArrayListCustom <T > filter (Predicate <T > o ) {
125
125
Objects .requireNonNull ((o ));
126
126
ArrayListCustom <T > newList = new ArrayListCustom <>();
127
- this .forEach ((item ) -> {
128
- if (o .test (item )) {
129
- newList .add (item );
130
- }
131
- });
127
+ this .forEach (o ::test );
132
128
return newList ;
133
129
}
134
130
Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ public V getValue() {
32
32
return this .val ;
33
33
}
34
34
35
+ @ Override
36
+ public String toString () {
37
+ return "{ " +key +" = " +val +" }" ;
38
+ }
35
39
}
36
40
37
41
private int hashCode (K key ) {
@@ -189,9 +193,7 @@ public Object[] toKeyArray() {
189
193
190
194
public Set <Entry <K , V >> entrySet () {
191
195
Set <Entry <K , V >> set = new HashSet <>();
192
- forEachEntry (entry -> {
193
- set .add (entry );
194
- });
196
+ forEachEntry (set ::add );
195
197
return set ;
196
198
}
197
199
You can’t perform that action at this time.
0 commit comments