Skip to content

Commit f0b0504

Browse files
author
Stefan Plantikow
committed
Merge pull request #125 from neo4j/1.0-streaming
Streaming cursor
2 parents dc349d2 + 539114c commit f0b0504

31 files changed

+612
-684
lines changed

driver/src/main/java/org/neo4j/driver/internal/InternalRecord.java

+7-8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package org.neo4j.driver.internal;
2020

2121
import java.util.Arrays;
22+
import java.util.HashMap;
2223
import java.util.List;
2324
import java.util.Map;
2425
import java.util.NoSuchElementException;
@@ -37,14 +38,12 @@
3738
public 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

Comments
 (0)