@Override public Iterable<String> keySet() { return map.keySet(); }
if ( compare == 0 ) String[] thisKeys = StreamSupport.stream( keySet().spliterator(), false).toArray( String[]::new ); Arrays.sort( thisKeys, String::compareTo ); String[] thatKeys = StreamSupport.stream( otherMap.keySet().spliterator(), false).toArray( String[]::new ); Arrays.sort( thatKeys, String::compareTo ); for ( int i = 0; i < size; i++ )
public ListValue keys() { String[] keys = new String[size()]; int i = 0; for ( String key : keySet() ) { keys[i++] = key; } return VirtualValues.fromArray( Values.stringArray( keys ) ); }
String[] thisKeys = StreamSupport.stream( keySet().spliterator(), false ).toArray( String[]::new ); Arrays.sort( thisKeys, String::compareTo ); String[] thatKeys = StreamSupport.stream( otherMap.keySet().spliterator(), false ).toArray( String[]::new ); Arrays.sort( thatKeys, String::compareTo ); for ( int i = 0; i < size; i++ )
private static String onlyTimezone( MapValue map ) { if ( map.size() == 1 ) { String key = single( map.keySet() ); if ( "timezone".equalsIgnoreCase( key ) ) { AnyValue timezone = map.get( key ); if ( timezone instanceof TextValue ) { return ((TextValue) timezone).stringValue(); } } } return null; }
private void assertMapValueEquals( MapValue a, MapValue b ) { assertThat( a, equalTo( b ) ); assertThat( a.size(), equalTo( b.size() ) ); assertThat( a.hashCode(), equalTo( b.hashCode() ) ); assertThat( a.keySet(), containsInAnyOrder( Iterables.asArray( String.class, b.keySet() ) ) ); assertThat( Arrays.asList( a.keys().asArray() ), containsInAnyOrder( b.keys().asArray() ) ); a.foreach( ( k, v ) -> assertThat( b.get( k ), equalTo( v ) ) ); b.foreach( ( k, v ) -> assertThat( a.get( k ), equalTo( v ) ) ); }
@Override public boolean equals( VirtualValue other ) { if ( !(other instanceof MapValue) ) { return false; } MapValue that = (MapValue) other; int size = size(); if ( size != that.size() ) { return false; } Iterable<String> keys = keySet(); for ( String key : keys ) { if ( !get( key ).equals( that.get( key ) ) ) { return false; } } return true; }
@Override public Iterable<String> keySet() { return map.keySet(); }
if ( compare == 0 ) String[] thisKeys = StreamSupport.stream( keySet().spliterator(), false).toArray( String[]::new ); Arrays.sort( thisKeys, String::compareTo ); String[] thatKeys = StreamSupport.stream( otherMap.keySet().spliterator(), false).toArray( String[]::new ); Arrays.sort( thatKeys, String::compareTo ); for ( int i = 0; i < size; i++ )
public ListValue keys() { String[] keys = new String[size()]; int i = 0; for ( String key : keySet() ) { keys[i++] = key; } return VirtualValues.fromArray( Values.stringArray( keys ) ); }
String[] thisKeys = StreamSupport.stream( keySet().spliterator(), false ).toArray( String[]::new ); Arrays.sort( thisKeys, String::compareTo ); String[] thatKeys = StreamSupport.stream( otherMap.keySet().spliterator(), false ).toArray( String[]::new ); Arrays.sort( thatKeys, String::compareTo ); for ( int i = 0; i < size; i++ )
private static String onlyTimezone( MapValue map ) { if ( map.size() == 1 ) { String key = single( map.keySet() ); if ( "timezone".equalsIgnoreCase( key ) ) { AnyValue timezone = map.get( key ); if ( timezone instanceof TextValue ) { return ((TextValue) timezone).stringValue(); } } } return null; }
@Override public boolean equals( VirtualValue other ) { if ( !(other instanceof MapValue) ) { return false; } MapValue that = (MapValue) other; int size = size(); if ( size != that.size() ) { return false; } Iterable<String> keys = keySet(); for ( String key : keys ) { if ( !get( key ).equals( that.get( key ) ) ) { return false; } } return true; }