### Question:
PrimitiveLongIntKeyValueArray { public int getOrDefault( long key, int defaultValue ) { int index = Arrays.binarySearch( sortedKeys, 0, size, key ); if ( index >= 0 ) { return sortedValues[index]; } else { return defaultValue; } } PrimitiveLongIntKeyValueArray( int initialCapacity, double growthFactor );  PrimitiveLongIntKeyValueArray( int initialCapacity );  PrimitiveLongIntKeyValueArray(); int capacity(); double growthFactor(); void ensureCapacity( int newCapacity ); int size(); int getOrDefault( long key, int defaultValue ); boolean putIfAbsent( long key, int value ); void reset( int newCapacity ); long[] keys(); static final int DEFAULT_INITIAL_CAPACITY; static final double DEFAULT_GROWTH_FACTOR; }### Answer:
@Test void testGetOrDefault() { PrimitiveLongIntKeyValueArray map = new PrimitiveLongIntKeyValueArray(); map.putIfAbsent( 1, 100 ); map.putIfAbsent( 2, 200 ); map.putIfAbsent( 3, 300 ); assertThat( map.getOrDefault( 1, DEFAULT_VALUE ), equalTo( 100 ) ); assertThat( map.getOrDefault( 2, DEFAULT_VALUE ), equalTo( 200 ) ); assertThat( map.getOrDefault( 3, DEFAULT_VALUE ), equalTo( 300 ) ); assertThat( map.getOrDefault( 4, DEFAULT_VALUE ), equalTo( DEFAULT_VALUE ) ); }