1919package org .neo4j .driver .internal ;
2020
2121import java .util .Arrays ;
22+ import java .util .HashMap ;
2223import java .util .List ;
2324import java .util .Map ;
2425import java .util .NoSuchElementException ;
3738public class InternalRecord extends InternalRecordAccessor implements Record
3839{
3940 private final List <String > keys ;
40- private final Map <String , Integer > keyIndexLookup ;
4141 private final Value [] values ;
4242 private int hashcode = 0 ;
4343
44- public InternalRecord ( List <String > keys , Map < String , Integer > keyIndexLookup , Value [] values )
44+ public InternalRecord ( List <String > keys , Value [] values )
4545 {
4646 this .keys = keys ;
47- this .keyIndexLookup = keyIndexLookup ;
4847 this .values = values ;
4948 }
5049
@@ -57,8 +56,8 @@ public List<String> keys()
5756 @ Override
5857 public int index ( String key )
5958 {
60- Integer result = keyIndexLookup . get ( key );
61- if ( result == null )
59+ int result = keys . indexOf ( key );
60+ if ( result == - 1 )
6261 {
6362 throw new NoSuchElementException ( "Unknown key: " + key );
6463 }
@@ -71,15 +70,15 @@ public int index( String key )
7170 @ Override
7271 public boolean containsKey ( String key )
7372 {
74- return keyIndexLookup . containsKey ( key );
73+ return keys . contains ( key );
7574 }
7675
7776 @ Override
7877 public Value get ( String key )
7978 {
80- Integer fieldIndex = keyIndexLookup . get ( key );
79+ int fieldIndex = keys . indexOf ( key );
8180
82- if ( fieldIndex == null )
81+ if ( fieldIndex == - 1 )
8382 {
8483 return Values .NULL ;
8584 }
0 commit comments