Skip to content

Commit

Permalink
Merge pull request #125 from neo4j/1.0-streaming
Browse files Browse the repository at this point in the history
Streaming cursor
  • Loading branch information
Stefan Plantikow committed Feb 18, 2016
2 parents dc349d2 + 539114c commit f0b0504
Show file tree
Hide file tree
Showing 31 changed files with 612 additions and 684 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.neo4j.driver.internal;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
Expand All @@ -37,14 +38,12 @@
public class InternalRecord extends InternalRecordAccessor implements Record
{
private final List<String> keys;
private final Map<String, Integer> keyIndexLookup;
private final Value[] values;
private int hashcode = 0;

public InternalRecord( List<String> keys, Map<String, Integer> keyIndexLookup, Value[] values )
public InternalRecord( List<String> keys, Value[] values )
{
this.keys = keys;
this.keyIndexLookup = keyIndexLookup;
this.values = values;
}

Expand All @@ -57,8 +56,8 @@ public List<String> keys()
@Override
public int index( String key )
{
Integer result = keyIndexLookup.get( key );
if ( result == null )
int result = keys.indexOf( key );
if ( result == -1 )
{
throw new NoSuchElementException( "Unknown key: " + key );
}
Expand All @@ -71,15 +70,15 @@ public int index( String key )
@Override
public boolean containsKey( String key )
{
return keyIndexLookup.containsKey( key );
return keys.contains( key );
}

@Override
public Value get( String key )
{
Integer fieldIndex = keyIndexLookup.get( key );
int fieldIndex = keys.indexOf( key );

if ( fieldIndex == null )
if ( fieldIndex == -1 )
{
return Values.NULL;
}
Expand Down
Loading

0 comments on commit f0b0504

Please sign in to comment.