@Test public void testEntrySet() { Set<Entry<String, String>> entries = map.entrySet(); assertThat( entries, hasSize( 6 ) ); assertThat( entries, hasItem( new Node<>( "a", "1" ) ) ); assertThat( entries, hasItem( new Node<>( "x", (String) null ) ) ); assertThat( entries, hasItem( new Node<>( "b", "2" ) ) ); assertThat( entries, hasItem( new Node<>( "c", "3" ) ) ); assertThat( entries, hasItem( new Node<>( "", "" ) ) ); assertThat( entries, hasItem( new Node<>( (String) null, "1" ) ) ); }
@Override public Set<Entry<K, V>> entrySet() { Set<Entry<K, V>> entries = new LinkedHashSet<>(); Node<K, V> node = first; while ( node != null ) { entries.add( node ); node = node.next; } return unmodifiableSet( entries ); }
ImmutableMap extends AbstractMap<K, V> { @Override public Set<Entry<K, V>> entrySet() { Set<Entry<K, V>> entries = new LinkedHashSet<>(); Node<K, V> node = first; while ( node != null ) { entries.add( node ); node = node.next; } return unmodifiableSet( entries ); } }
ImmutableMap extends AbstractMap<K, V> { @Override public Set<Entry<K, V>> entrySet() { Set<Entry<K, V>> entries = new LinkedHashSet<>(); Node<K, V> node = first; while ( node != null ) { entries.add( node ); node = node.next; } return unmodifiableSet( entries ); } ImmutableMap( Map<K, V> map ); }
ImmutableMap extends AbstractMap<K, V> { @Override public Set<Entry<K, V>> entrySet() { Set<Entry<K, V>> entries = new LinkedHashSet<>(); Node<K, V> node = first; while ( node != null ) { entries.add( node ); node = node.next; } return unmodifiableSet( entries ); } ImmutableMap( Map<K, V> map ); @Override Set<Entry<K, V>> entrySet(); }
ImmutableMap extends AbstractMap<K, V> { @Override public Set<Entry<K, V>> entrySet() { Set<Entry<K, V>> entries = new LinkedHashSet<>(); Node<K, V> node = first; while ( node != null ) { entries.add( node ); node = node.next; } return unmodifiableSet( entries ); } ImmutableMap( Map<K, V> map ); @Override Set<Entry<K, V>> entrySet();  }