19
19
package org .neo4j .driver .internal ;
20
20
21
21
import java .util .Arrays ;
22
+ import java .util .HashMap ;
22
23
import java .util .List ;
23
24
import java .util .Map ;
24
25
import java .util .NoSuchElementException ;
37
38
public class InternalRecord extends InternalRecordAccessor implements Record
38
39
{
39
40
private final List <String > keys ;
40
- private final Map <String , Integer > keyIndexLookup ;
41
41
private final Value [] values ;
42
42
private int hashcode = 0 ;
43
43
44
- public InternalRecord ( List <String > keys , Map < String , Integer > keyIndexLookup , Value [] values )
44
+ public InternalRecord ( List <String > keys , Value [] values )
45
45
{
46
46
this .keys = keys ;
47
- this .keyIndexLookup = keyIndexLookup ;
48
47
this .values = values ;
49
48
}
50
49
@@ -57,8 +56,8 @@ public List<String> keys()
57
56
@ Override
58
57
public int index ( String key )
59
58
{
60
- Integer result = keyIndexLookup . get ( key );
61
- if ( result == null )
59
+ int result = keys . indexOf ( key );
60
+ if ( result == - 1 )
62
61
{
63
62
throw new NoSuchElementException ( "Unknown key: " + key );
64
63
}
@@ -71,15 +70,15 @@ public int index( String key )
71
70
@ Override
72
71
public boolean containsKey ( String key )
73
72
{
74
- return keyIndexLookup . containsKey ( key );
73
+ return keys . contains ( key );
75
74
}
76
75
77
76
@ Override
78
77
public Value get ( String key )
79
78
{
80
- Integer fieldIndex = keyIndexLookup . get ( key );
79
+ int fieldIndex = keys . indexOf ( key );
81
80
82
- if ( fieldIndex == null )
81
+ if ( fieldIndex == - 1 )
83
82
{
84
83
return Values .NULL ;
85
84
}
0 commit comments