    private long createPropertyChain( Map<String, Object> properties )
    {
        if ( properties == null || properties.isEmpty() )
        {
            return Record.NO_NEXT_PROPERTY.intValue();
        }
        PropertyStore propStore = getPropertyStore();
        List<PropertyRecord> propRecords = new ArrayList<>();
        PropertyRecord currentRecord = new PropertyRecord( propStore.nextId() );
        currentRecord.setInUse( true );
        currentRecord.setCreated();
        propRecords.add( currentRecord );
        for ( Entry<String, Object> entry : properties.entrySet() )
        {
            int keyId = propertyKeyTokens.idOf( entry.getKey() );
            if ( keyId == -1 )
            {
                keyId = createNewPropertyKeyId( entry.getKey() );
            }

            PropertyBlock block = new PropertyBlock();
            propStore.encodeValue( block, keyId, entry.getValue() );
            if ( currentRecord.size() + block.getSize() > PropertyType.getPayloadSize() )
            {
                // Here it means the current block is done for
                PropertyRecord prevRecord = currentRecord;
                // Create new record
                long propertyId = propStore.nextId();
                currentRecord = new PropertyRecord( propertyId );
                currentRecord.setInUse( true );
                currentRecord.setCreated();
                // Set up links
                prevRecord.setNextProp( propertyId );
                currentRecord.setPrevProp( prevRecord.getId() );
                propRecords.add( currentRecord );
                // Now current is ready to start picking up blocks
            }
            currentRecord.addPropertyBlock( block );
        }
        /*
         * Add the property records in reverse order, which means largest
         * id first. That is to make sure we expand the property store file
         * only once.
         */
        for ( int i = propRecords.size() - 1; i >= 0; i-- )
        {
            propStore.updateRecord( propRecords.get( i ) );
        }
        /*
         *  0 will always exist, if the map was empty we wouldn't be here
         *  and even one property will create at least one record.
         */
        return propRecords.get( 0 ).getId();
    }

    private long createPropertyChain( Map<String, Object> properties )
    {
        if ( properties == null || properties.isEmpty() )
        {
            return Record.NO_NEXT_PROPERTY.intValue();
        }
        PropertyStore propStore = getPropertyStore();
        List<PropertyRecord> propRecords = new ArrayList<PropertyRecord>();
        PropertyRecord currentRecord = new PropertyRecord( propStore.nextId() );
        currentRecord.setInUse( true );
        currentRecord.setCreated();
        propRecords.add( currentRecord );
        for ( Entry<String, Object> entry : properties.entrySet() )
        {
            int keyId = propertyKeyTokens.idOf( entry.getKey() );
            if ( keyId == -1 )
            {
                keyId = createNewPropertyKeyId( entry.getKey() );
            }

            PropertyBlock block = new PropertyBlock();
            propStore.encodeValue( block, keyId, entry.getValue() );
            if ( currentRecord.size() + block.getSize() > PropertyType.getPayloadSize() )
            {
                // Here it means the current block is done for
                PropertyRecord prevRecord = currentRecord;
                // Create new record
                long propertyId = propStore.nextId();
                currentRecord = new PropertyRecord( propertyId );
                currentRecord.setInUse( true );
                currentRecord.setCreated();
                // Set up links
                prevRecord.setNextProp( propertyId );
                currentRecord.setPrevProp( prevRecord.getId() );
                propRecords.add( currentRecord );
                // Now current is ready to start picking up blocks
            }
            currentRecord.addPropertyBlock( block );
        }
        /*
         * Add the property records in reverse order, which means largest
         * id first. That is to make sure we expand the property store file
         * only once.
         */
        for ( int i = propRecords.size() - 1; i >= 0; i-- )
        {
            propStore.updateRecord( propRecords.get( i ) );
        }
        /*
         *  0 will always exist, if the map was empty we wouldn't be here
         *  and even one property will create at least one record.
         */
        return propRecords.get( 0 ).getId();
    }

Replace Generic With Diamond ArrayList<PropertyRecord> with ArrayList<> in method private createPropertyChain(properties Map<String,Object>) : long from class org.neo4j.unsafe.batchinsert.BatchInserterImpl


    private Map<String, Object> getPropertyChain( long nextProp )
    {
        PropertyStore propStore = getPropertyStore();
        Map<String, Object> properties = new HashMap<>();

        while ( nextProp != Record.NO_NEXT_PROPERTY.intValue() )
        {
            PropertyRecord propRecord = propStore.getRecord( nextProp );
            for ( PropertyBlock propBlock : propRecord.getPropertyBlocks() )
            {
                String key = propertyKeyTokens.nameOf( propBlock.getKeyIndexId() );
                PropertyData propertyData = propBlock.newPropertyData( propRecord );
                Object value = propertyData.getValue() != null ? propertyData.getValue() :
                               propBlock.getType().getValue( propBlock, getPropertyStore() );
                properties.put( key, value );
            }
            nextProp = propRecord.getNextProp();
        }
        return properties;
    }

    private Map<String, Object> getPropertyChain( long nextProp )
    {
        PropertyStore propStore = getPropertyStore();
        Map<String, Object> properties = new HashMap<String, Object>();

        while ( nextProp != Record.NO_NEXT_PROPERTY.intValue() )
        {
            PropertyRecord propRecord = propStore.getRecord( nextProp );
            for ( PropertyBlock propBlock : propRecord.getPropertyBlocks() )
            {
                String key = propertyKeyTokens.nameOf( propBlock.getKeyIndexId() );
                PropertyData propertyData = propBlock.newPropertyData( propRecord );
                Object value = propertyData.getValue() != null ? propertyData.getValue() :
                               propBlock.getType().getValue( propBlock, getPropertyStore() );
                properties.put( key, value );
            }
            nextProp = propRecord.getNextProp();
        }
        return properties;
    }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method private getPropertyChain(nextProp long) : Map<String,Object> from class org.neo4j.unsafe.batchinsert.BatchInserterImpl


    @Test
    public void getAllNodesShouldConsiderTxState() throws Exception
    {
        // GIVEN
        // Three nodes
        Transaction tx = db.beginTx();
        Node referenceNode = db.getReferenceNode();
        Node firstCommittedNode = db.createNode();
        Node secondCommittedNode = db.createNode();
        Node thirdCommittedNode = db.createNode();
        tx.success();
        tx.finish();

        // Second one deleted, just to create a hole
        tx = db.beginTx();
        secondCommittedNode.delete();
        tx.success();
        tx.finish();

        // WHEN
        tx = db.beginTx();
        Node firstAdditionalNode = db.createNode();
        Node secondAdditionalNode = db.createNode();
        thirdCommittedNode.delete();
        List<Node> allNodes = addToCollection( getNodeManager().getAllNodes(), new ArrayList<Node>() );
        Set<Node> allNodesSet = new HashSet<>( allNodes );
        tx.finish();

        // THEN
        assertEquals( allNodes.size(), allNodesSet.size() );
        assertEquals( asSet( referenceNode, firstCommittedNode, firstAdditionalNode, secondAdditionalNode ), allNodesSet );
    }

    @Test
    public void getAllNodesShouldConsiderTxState() throws Exception
    {
        // GIVEN
        // Three nodes
        Transaction tx = db.beginTx();
        Node referenceNode = db.getReferenceNode();
        Node firstCommittedNode = db.createNode();
        Node secondCommittedNode = db.createNode();
        Node thirdCommittedNode = db.createNode();
        tx.success();
        tx.finish();

        // Second one deleted, just to create a hole
        tx = db.beginTx();
        secondCommittedNode.delete();
        tx.success();
        tx.finish();

        // WHEN
        tx = db.beginTx();
        Node firstAdditionalNode = db.createNode();
        Node secondAdditionalNode = db.createNode();
        thirdCommittedNode.delete();
        List<Node> allNodes = addToCollection( getNodeManager().getAllNodes(), new ArrayList<Node>() );
        Set<Node> allNodesSet = new HashSet<Node>( allNodes );
        tx.finish();

        // THEN
        assertEquals( allNodes.size(), allNodesSet.size() );
        assertEquals( asSet( referenceNode, firstCommittedNode, firstAdditionalNode, secondAdditionalNode ), allNodesSet );
    }

Replace Generic With Diamond HashSet<Node> with HashSet<> in method public getAllNodesShouldConsiderTxState() : void from class org.neo4j.kernel.impl.core.NodeManagerTest


    @Test
    public void getAllRelationshipsShouldConsiderTxState() throws Exception
    {
        // GIVEN
        // Three relationships
        Transaction tx = db.beginTx();
        Relationship firstCommittedRelationship = createRelationshipAssumingTxWith( "committed", 1 );
        Relationship secondCommittedRelationship = createRelationshipAssumingTxWith( "committed", 2 );
        Relationship thirdCommittedRelationship = createRelationshipAssumingTxWith( "committed", 3 );
        tx.success();
        tx.finish();

        tx = db.beginTx();
        secondCommittedRelationship.delete();
        tx.success();
        tx.finish();

        // WHEN
        tx = db.beginTx();
        Relationship firstAdditionalRelationship = createRelationshipAssumingTxWith( "additional", 1 );
        Relationship secondAdditionalRelationship = createRelationshipAssumingTxWith( "additional", 2 );
        thirdCommittedRelationship.delete();
        List<Relationship> allRelationships = addToCollection( getNodeManager().getAllRelationships(),
                new ArrayList<Relationship>() );
        Set<Relationship> allRelationshipsSet = new HashSet<>( allRelationships );
        tx.finish();

        // THEN
        assertEquals( allRelationships.size(), allRelationshipsSet.size() );
        assertEquals( asSet( firstCommittedRelationship, firstAdditionalRelationship, secondAdditionalRelationship ),
                allRelationshipsSet );
    }

    @Test
    public void getAllRelationshipsShouldConsiderTxState() throws Exception
    {
        // GIVEN
        // Three relationships
        Transaction tx = db.beginTx();
        Relationship firstCommittedRelationship = createRelationshipAssumingTxWith( "committed", 1 );
        Relationship secondCommittedRelationship = createRelationshipAssumingTxWith( "committed", 2 );
        Relationship thirdCommittedRelationship = createRelationshipAssumingTxWith( "committed", 3 );
        tx.success();
        tx.finish();

        tx = db.beginTx();
        secondCommittedRelationship.delete();
        tx.success();
        tx.finish();

        // WHEN
        tx = db.beginTx();
        Relationship firstAdditionalRelationship = createRelationshipAssumingTxWith( "additional", 1 );
        Relationship secondAdditionalRelationship = createRelationshipAssumingTxWith( "additional", 2 );
        thirdCommittedRelationship.delete();
        List<Relationship> allRelationships = addToCollection( getNodeManager().getAllRelationships(),
                new ArrayList<Relationship>() );
        Set<Relationship> allRelationshipsSet = new HashSet<Relationship>( allRelationships );
        tx.finish();

        // THEN
        assertEquals( allRelationships.size(), allRelationshipsSet.size() );
        assertEquals( asSet( firstCommittedRelationship, firstAdditionalRelationship, secondAdditionalRelationship ),
                allRelationshipsSet );
    }

Replace Generic With Diamond HashSet<Relationship> with HashSet<> in method public getAllRelationshipsShouldConsiderTxState() : void from class org.neo4j.kernel.impl.core.NodeManagerTest


    public static <T> Iterable<T> concat( final Iterable<Iterable<T>> iterables )
    {
        return new CombiningIterable<>( iterables );
    }

    public static <T> Iterable<T> concat( final Iterable<Iterable<T>> iterables )
    {
        return new CombiningIterable<T>( iterables );
    }

Replace Generic With Diamond CombiningIterable<T> with CombiningIterable<> in method public concat(iterables Iterable<Iterable<T>>) : Iterable<T> from class org.neo4j.helpers.collection.Iterables


    @Override
    public UniquenessConstraint uniquenessConstraintCreate( StatementState state, long labelId, long propertyKeyId )
            throws SchemaKernelException
    {
        UniquenessConstraint constraint = new UniquenessConstraint( labelId, propertyKeyId );
        if ( !state.txState().constraintDoUnRemove( constraint ) )
        {
            for ( Iterator<UniquenessConstraint> it = schemaReadDelegate.constraintsGetForLabelAndPropertyKey(
                    state, labelId, propertyKeyId ); it.hasNext(); )
            {
                if ( it.next().equals( labelId, propertyKeyId ) )
                {
                    return constraint;
                }
            }

            try
            {
                long indexId = constraintIndexCreator.createUniquenessConstraintIndex(
                        state, this, labelId, propertyKeyId );
                state.txState().constraintDoAdd( constraint, indexId );
            }
            catch ( TransactionalException | KernelException e )
            {
                throw new ConstraintCreationKernelException( constraint, e );
            }
        }
        return constraint;
    }

    @Override
    public UniquenessConstraint uniquenessConstraintCreate( StatementState state, long labelId, long propertyKeyId )
            throws SchemaKernelException
    {
        UniquenessConstraint constraint = new UniquenessConstraint( labelId, propertyKeyId );
        if ( !state.txState().constraintDoUnRemove( constraint ) )
        {
            for ( Iterator<UniquenessConstraint> it = schemaReadDelegate.constraintsGetForLabelAndPropertyKey(
                    state, labelId, propertyKeyId ); it.hasNext(); )
            {
                if ( it.next().equals( labelId, propertyKeyId ) )
                {
                    return constraint;
                }
            }

            try
            {
                long indexId = constraintIndexCreator.createUniquenessConstraintIndex(
                        state, this, labelId, propertyKeyId );
                state.txState().constraintDoAdd( constraint, indexId );
            }
            catch ( TransactionalException e )
            {
                throw new ConstraintCreationKernelException( constraint, e );
            }
            catch ( KernelException e )
            {
                throw new ConstraintCreationKernelException( constraint, e );
            }
        }
        return constraint;
    }

Merge Catch [catch(TransactionalException e), catch(KernelException e)] to catch(TransactionalException|KernelException e) in method public uniquenessConstraintCreate(state StatementState, labelId long, propertyKeyId long) : UniquenessConstraint from class org.neo4j.kernel.impl.api.StateHandlingStatementOperations


    @Override
    public Object getProperty( String key )
    {
        // TODO: Push this check to getPropertyKeyId
        // ^^^^^ actually, if the key is null, we could fail before getting the statement context...
        if ( null == key )
            throw new IllegalArgumentException( "(null) property key is not allowed" );

        StatementOperationParts ctxForReading = statementCtxProvider.getCtxForReading();
        StatementState state = statementCtxProvider.statementForReading();
        try
        {
            long propertyId = ctxForReading.keyReadOperations().propertyKeyGetForName( state, key );
            return ctxForReading.entityReadOperations().graphGetProperty( state, propertyId ).value();
        }
        catch ( PropertyKeyIdNotFoundException | PropertyKeyNotFoundException | PropertyNotFoundException e )
        {
            throw new NotFoundException( e );
        }
        finally
        {
            ctxForReading.close( state );
        }
    }

    @Override
    public Object getProperty( String key )
    {
        // TODO: Push this check to getPropertyKeyId
        // ^^^^^ actually, if the key is null, we could fail before getting the statement context...
        if ( null == key )
            throw new IllegalArgumentException( "(null) property key is not allowed" );

        StatementOperationParts ctxForReading = statementCtxProvider.getCtxForReading();
        StatementState state = statementCtxProvider.statementForReading();
        try
        {
            long propertyId = ctxForReading.keyReadOperations().propertyKeyGetForName( state, key );
            return ctxForReading.entityReadOperations().graphGetProperty( state, propertyId ).value();
        }
        catch ( PropertyKeyIdNotFoundException e )
        {
            throw new NotFoundException( e );
        }
        catch ( PropertyKeyNotFoundException e )
        {
            throw new NotFoundException( e );
        }
        catch ( PropertyNotFoundException e )
        {
            throw new NotFoundException( e );
        }
        finally
        {
            ctxForReading.close( state );
        }
    }

Merge Catch [catch(PropertyKeyIdNotFoundException e), catch(PropertyKeyNotFoundException e), catch(PropertyNotFoundException e)] to catch(PropertyKeyIdNotFoundException|PropertyKeyNotFoundException|PropertyNotFoundException e) in method public getProperty(key String) : Object from class org.neo4j.kernel.impl.core.GraphPropertiesImpl


        NonUniqueInMemoryIndexReader( Map<Object, Set<Long>> indexData )
        {
            this.indexData = new HashMap<>( indexData );
        }

        NonUniqueInMemoryIndexReader( Map<Object, Set<Long>> indexData )
        {
            this.indexData = new HashMap<Object, Set<Long>>( indexData );
        }

Replace Generic With Diamond HashMap<Object,Set<Long>> with HashMap<> in method package NonUniqueInMemoryIndexReader(indexData Map<Object,Set<Long>>) from class org.neo4j.kernel.impl.api.index.inmemory.NonUniqueInMemoryIndex.NonUniqueInMemoryIndexReader


    private Set<Long> getLongs( Object propertyValue )
    {
        Object key = encode( propertyValue );
        Set<Long> nodes = indexData.get( key );
        if ( nodes == null )
        {
            nodes = new HashSet<>();
            indexData.put( key, nodes );
        }
        return nodes;
    }

    private Set<Long> getLongs( Object propertyValue )
    {
        Object key = encode( propertyValue );
        Set<Long> nodes = indexData.get( key );
        if ( nodes == null )
        {
            nodes = new HashSet<Long>();
            indexData.put( key, nodes );
        }
        return nodes;
    }

Replace Generic With Diamond HashSet<Long> with HashSet<> in method private getLongs(propertyValue Object) : Set<Long> from class org.neo4j.kernel.impl.api.index.inmemory.NonUniqueInMemoryIndex


    UniqueInMemoryIndexReader( Map<Object, Long> indexData )
    {
        this.indexData = new HashMap<>( indexData );
    }

    UniqueInMemoryIndexReader( Map<Object, Long> indexData )
    {
        this.indexData = new HashMap<Object, Long>( indexData );
    }

Replace Generic With Diamond HashMap<Object,Long> with HashMap<> in method package UniqueInMemoryIndexReader(indexData Map<Object,Long>) from class org.neo4j.kernel.impl.api.index.inmemory.UniqueInMemoryIndexReader


    private Map<String, String> getConfig()
    {
        if ( config == null )
        {
            config = new HashMap<>();
        }
        return config;
    }

    private Map<String, String> getConfig()
    {
        if ( config == null )
        {
            config = new HashMap<String, String>();
        }
        return config;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method private getConfig() : Map<String,String> from class org.neo4j.index.impl.lucene.TestAutoIndexing


    @Test
    public void testConfigAndAPICompatibility()
    {
        stopDb();
        config = new HashMap<>();
        config.put( GraphDatabaseSettings.node_keys_indexable.name(), "nodeProp1, nodeProp2" );
        config.put( GraphDatabaseSettings.relationship_keys_indexable.name(), "relProp1, relProp2" );
        config.put( GraphDatabaseSettings.node_auto_indexing.name(), "true" );
        config.put( GraphDatabaseSettings.relationship_auto_indexing.name(), "true" );
        startDb();

        assertTrue( graphDb.index().getNodeAutoIndexer().isEnabled() );
        assertTrue( graphDb.index().getRelationshipAutoIndexer().isEnabled() );

        AutoIndexer<Node> autoNodeIndexer = graphDb.index().getNodeAutoIndexer();
        // Start auto indexing a new and an already auto indexed
        autoNodeIndexer.startAutoIndexingProperty( "nodeProp1" );
        autoNodeIndexer.startAutoIndexingProperty( "nodeProp3" );
        assertEquals( 3, autoNodeIndexer.getAutoIndexedProperties().size() );
        assertTrue( autoNodeIndexer.getAutoIndexedProperties().contains(
                "nodeProp1" ) );
        assertTrue( autoNodeIndexer.getAutoIndexedProperties().contains(
                "nodeProp2" ) );
        assertTrue( autoNodeIndexer.getAutoIndexedProperties().contains(
                "nodeProp3" ) );
    }

    @Test
    public void testConfigAndAPICompatibility()
    {
        stopDb();
        config = new HashMap<String, String>();
        config.put( GraphDatabaseSettings.node_keys_indexable.name(), "nodeProp1, nodeProp2" );
        config.put( GraphDatabaseSettings.relationship_keys_indexable.name(), "relProp1, relProp2" );
        config.put( GraphDatabaseSettings.node_auto_indexing.name(), "true" );
        config.put( GraphDatabaseSettings.relationship_auto_indexing.name(), "true" );
        startDb();

        assertTrue( graphDb.index().getNodeAutoIndexer().isEnabled() );
        assertTrue( graphDb.index().getRelationshipAutoIndexer().isEnabled() );

        AutoIndexer<Node> autoNodeIndexer = graphDb.index().getNodeAutoIndexer();
        // Start auto indexing a new and an already auto indexed
        autoNodeIndexer.startAutoIndexingProperty( "nodeProp1" );
        autoNodeIndexer.startAutoIndexingProperty( "nodeProp3" );
        assertEquals( 3, autoNodeIndexer.getAutoIndexedProperties().size() );
        assertTrue( autoNodeIndexer.getAutoIndexedProperties().contains(
                "nodeProp1" ) );
        assertTrue( autoNodeIndexer.getAutoIndexedProperties().contains(
                "nodeProp2" ) );
        assertTrue( autoNodeIndexer.getAutoIndexedProperties().contains(
                "nodeProp3" ) );
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public testConfigAndAPICompatibility() : void from class org.neo4j.index.impl.lucene.TestAutoIndexing


    @Test
    public void testSmallGraphWithNonIndexableProps() throws Exception
    {
        stopDb();
        config = new HashMap<>();
        config.put( GraphDatabaseSettings.node_keys_indexable.name(), "nodeProp1, nodeProp2" );
        config.put( GraphDatabaseSettings.relationship_keys_indexable.name(), "relProp1, relProp2" );
        config.put( GraphDatabaseSettings.node_auto_indexing.name(), "true" );
        config.put( GraphDatabaseSettings.relationship_auto_indexing.name(), "true" );
        startDb();

        assertTrue( graphDb.index().getNodeAutoIndexer().isEnabled() );
        assertTrue( graphDb.index().getRelationshipAutoIndexer().isEnabled() );

        newTransaction();

        // Build the graph, a 3-cycle
        Node node1 = graphDb.createNode();
        Node node2 = graphDb.createNode();
        Node node3 = graphDb.createNode();

        Relationship rel12 = node1.createRelationshipTo( node2,
                DynamicRelationshipType.withName( "DYNAMIC" ) );
        Relationship rel23 = node2.createRelationshipTo( node3,
                DynamicRelationshipType.withName( "DYNAMIC" ) );
        Relationship rel31 = node3.createRelationshipTo( node1,
                DynamicRelationshipType.withName( "DYNAMIC" ) );

        // Nodes
        node1.setProperty( "nodeProp1", "node1Value1" );
        node1.setProperty( "nodePropNonIndexable1", "node1ValueNonIndexable" );

        node2.setProperty( "nodeProp2", "node2Value1" );
        node2.setProperty( "nodePropNonIndexable2", "node2ValueNonIndexable" );

        node3.setProperty( "nodeProp1", "node3Value1" );
        node3.setProperty( "nodeProp2", "node3Value2" );
        node3.setProperty( "nodePropNonIndexable3", "node3ValueNonIndexable" );

        // Relationships
        rel12.setProperty( "relProp1", "rel12Value1" );
        rel12.setProperty( "relPropNonIndexable1", "rel12ValueNonIndexable" );

        rel23.setProperty( "relProp2", "rel23Value1" );
        rel23.setProperty( "relPropNonIndexable2", "rel23ValueNonIndexable" );

        rel31.setProperty( "relProp1", "rel31Value1" );
        rel31.setProperty( "relProp2", "rel31Value2" );
        rel31.setProperty( "relPropNonIndexable3", "rel31ValueNonIndexable" );

        newTransaction();

        // Committed, time to check
        AutoIndexer<Node> autoNodeIndexer = graphDb.index().getNodeAutoIndexer();
        assertEquals(
                node1,
                autoNodeIndexer.getAutoIndex().get( "nodeProp1", "node1Value1" ).getSingle() );
        assertEquals(
                node2,
                autoNodeIndexer.getAutoIndex().get( "nodeProp2", "node2Value1" ).getSingle() );
        assertEquals(
                node3,
                autoNodeIndexer.getAutoIndex().get( "nodeProp1", "node3Value1" ).getSingle() );
        assertEquals(
                node3,
                autoNodeIndexer.getAutoIndex().get( "nodeProp2", "node3Value2" ).getSingle() );
        assertFalse( autoNodeIndexer.getAutoIndex().get(
                "nodePropNonIndexable1",
                "node1ValueNonIndexable" ).hasNext() );
        assertFalse( autoNodeIndexer.getAutoIndex().get(
                "nodePropNonIndexable2",
                "node2ValueNonIndexable" ).hasNext() );
        assertFalse( autoNodeIndexer.getAutoIndex().get(
                "nodePropNonIndexable3",
                "node3ValueNonIndexable" ).hasNext() );

        AutoIndexer<Relationship> autoRelIndexer = graphDb.index().getRelationshipAutoIndexer();
        assertEquals(
                rel12,
                autoRelIndexer.getAutoIndex().get( "relProp1",
                        "rel12Value1" ).getSingle() );
        assertEquals(
                rel23,
                autoRelIndexer.getAutoIndex().get( "relProp2",
                        "rel23Value1" ).getSingle() );
        assertEquals(
                rel31,
                autoRelIndexer.getAutoIndex().get( "relProp1",
                        "rel31Value1" ).getSingle() );
        assertEquals(
                rel31,
                autoRelIndexer.getAutoIndex().get( "relProp2",
                        "rel31Value2" ).getSingle() );
        assertFalse( autoRelIndexer.getAutoIndex().get(
                "relPropNonIndexable1",
                "rel12ValueNonIndexable" ).hasNext() );
        assertFalse( autoRelIndexer.getAutoIndex().get(
                "relPropNonIndexable2",
                "rel23ValueNonIndexable" ).hasNext() );
        assertFalse( autoRelIndexer.getAutoIndex().get(
                "relPropNonIndexable3",
                "rel31ValueNonIndexable" ).hasNext() );
    }

    @Test
    public void testSmallGraphWithNonIndexableProps() throws Exception
    {
        stopDb();
        config = new HashMap<String, String>();
        config.put( GraphDatabaseSettings.node_keys_indexable.name(), "nodeProp1, nodeProp2" );
        config.put( GraphDatabaseSettings.relationship_keys_indexable.name(), "relProp1, relProp2" );
        config.put( GraphDatabaseSettings.node_auto_indexing.name(), "true" );
        config.put( GraphDatabaseSettings.relationship_auto_indexing.name(), "true" );
        startDb();

        assertTrue( graphDb.index().getNodeAutoIndexer().isEnabled() );
        assertTrue( graphDb.index().getRelationshipAutoIndexer().isEnabled() );

        newTransaction();

        // Build the graph, a 3-cycle
        Node node1 = graphDb.createNode();
        Node node2 = graphDb.createNode();
        Node node3 = graphDb.createNode();

        Relationship rel12 = node1.createRelationshipTo( node2,
                DynamicRelationshipType.withName( "DYNAMIC" ) );
        Relationship rel23 = node2.createRelationshipTo( node3,
                DynamicRelationshipType.withName( "DYNAMIC" ) );
        Relationship rel31 = node3.createRelationshipTo( node1,
                DynamicRelationshipType.withName( "DYNAMIC" ) );

        // Nodes
        node1.setProperty( "nodeProp1", "node1Value1" );
        node1.setProperty( "nodePropNonIndexable1", "node1ValueNonIndexable" );

        node2.setProperty( "nodeProp2", "node2Value1" );
        node2.setProperty( "nodePropNonIndexable2", "node2ValueNonIndexable" );

        node3.setProperty( "nodeProp1", "node3Value1" );
        node3.setProperty( "nodeProp2", "node3Value2" );
        node3.setProperty( "nodePropNonIndexable3", "node3ValueNonIndexable" );

        // Relationships
        rel12.setProperty( "relProp1", "rel12Value1" );
        rel12.setProperty( "relPropNonIndexable1", "rel12ValueNonIndexable" );

        rel23.setProperty( "relProp2", "rel23Value1" );
        rel23.setProperty( "relPropNonIndexable2", "rel23ValueNonIndexable" );

        rel31.setProperty( "relProp1", "rel31Value1" );
        rel31.setProperty( "relProp2", "rel31Value2" );
        rel31.setProperty( "relPropNonIndexable3", "rel31ValueNonIndexable" );

        newTransaction();

        // Committed, time to check
        AutoIndexer<Node> autoNodeIndexer = graphDb.index().getNodeAutoIndexer();
        assertEquals(
                node1,
                autoNodeIndexer.getAutoIndex().get( "nodeProp1", "node1Value1" ).getSingle() );
        assertEquals(
                node2,
                autoNodeIndexer.getAutoIndex().get( "nodeProp2", "node2Value1" ).getSingle() );
        assertEquals(
                node3,
                autoNodeIndexer.getAutoIndex().get( "nodeProp1", "node3Value1" ).getSingle() );
        assertEquals(
                node3,
                autoNodeIndexer.getAutoIndex().get( "nodeProp2", "node3Value2" ).getSingle() );
        assertFalse( autoNodeIndexer.getAutoIndex().get(
                "nodePropNonIndexable1",
                "node1ValueNonIndexable" ).hasNext() );
        assertFalse( autoNodeIndexer.getAutoIndex().get(
                "nodePropNonIndexable2",
                "node2ValueNonIndexable" ).hasNext() );
        assertFalse( autoNodeIndexer.getAutoIndex().get(
                "nodePropNonIndexable3",
                "node3ValueNonIndexable" ).hasNext() );

        AutoIndexer<Relationship> autoRelIndexer = graphDb.index().getRelationshipAutoIndexer();
        assertEquals(
                rel12,
                autoRelIndexer.getAutoIndex().get( "relProp1",
                        "rel12Value1" ).getSingle() );
        assertEquals(
                rel23,
                autoRelIndexer.getAutoIndex().get( "relProp2",
                        "rel23Value1" ).getSingle() );
        assertEquals(
                rel31,
                autoRelIndexer.getAutoIndex().get( "relProp1",
                        "rel31Value1" ).getSingle() );
        assertEquals(
                rel31,
                autoRelIndexer.getAutoIndex().get( "relProp2",
                        "rel31Value2" ).getSingle() );
        assertFalse( autoRelIndexer.getAutoIndex().get(
                "relPropNonIndexable1",
                "rel12ValueNonIndexable" ).hasNext() );
        assertFalse( autoRelIndexer.getAutoIndex().get(
                "relPropNonIndexable2",
                "rel23ValueNonIndexable" ).hasNext() );
        assertFalse( autoRelIndexer.getAutoIndex().get(
                "relPropNonIndexable3",
                "rel31ValueNonIndexable" ).hasNext() );
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public testSmallGraphWithNonIndexableProps() : void from class org.neo4j.index.impl.lucene.TestAutoIndexing


    @Test
    public void testDefaultIsOffIfExplicit() throws Exception
    {
        stopDb();
        config = new HashMap<>();
        config.put( GraphDatabaseSettings.node_keys_indexable.name(), "nodeProp1, nodeProp2" );
        config.put( GraphDatabaseSettings.relationship_keys_indexable.name(), "relProp1, relProp2" );
        config.put( GraphDatabaseSettings.node_auto_indexing.name(), "false" );
        config.put( GraphDatabaseSettings.relationship_auto_indexing.name(), "false" );
        startDb();

        AutoIndexer<Node> autoIndexer = graphDb.index().getNodeAutoIndexer();
        autoIndexer.startAutoIndexingProperty( "testProp" );
        newTransaction();

        Node node1 = graphDb.createNode();
        node1.setProperty( "nodeProp1", "node1" );
        node1.setProperty( "nodeProp2", "node1" );
        node1.setProperty( "testProp", "node1" );

        newTransaction();

        assertFalse( autoIndexer.getAutoIndex().get( "nodeProp1", "node1" ).hasNext() );
        assertFalse( autoIndexer.getAutoIndex().get( "nodeProp2", "node1" ).hasNext() );
        assertFalse( autoIndexer.getAutoIndex().get( "testProp", "node1" ).hasNext() );
    }

    @Test
    public void testDefaultIsOffIfExplicit() throws Exception
    {
        stopDb();
        config = new HashMap<String, String>();
        config.put( GraphDatabaseSettings.node_keys_indexable.name(), "nodeProp1, nodeProp2" );
        config.put( GraphDatabaseSettings.relationship_keys_indexable.name(), "relProp1, relProp2" );
        config.put( GraphDatabaseSettings.node_auto_indexing.name(), "false" );
        config.put( GraphDatabaseSettings.relationship_auto_indexing.name(), "false" );
        startDb();

        AutoIndexer<Node> autoIndexer = graphDb.index().getNodeAutoIndexer();
        autoIndexer.startAutoIndexingProperty( "testProp" );
        newTransaction();

        Node node1 = graphDb.createNode();
        node1.setProperty( "nodeProp1", "node1" );
        node1.setProperty( "nodeProp2", "node1" );
        node1.setProperty( "testProp", "node1" );

        newTransaction();

        assertFalse( autoIndexer.getAutoIndex().get( "nodeProp1", "node1" ).hasNext() );
        assertFalse( autoIndexer.getAutoIndex().get( "nodeProp2", "node1" ).hasNext() );
        assertFalse( autoIndexer.getAutoIndex().get( "testProp", "node1" ).hasNext() );
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public testDefaultIsOffIfExplicit() : void from class org.neo4j.index.impl.lucene.TestAutoIndexing


    @Test
    public void testDefaultsAreSeparateForNodesAndRelationships()
            throws Exception
    {
        stopDb();
        config = new HashMap<>();
        config.put( GraphDatabaseSettings.node_keys_indexable.name(), "propName" );
        config.put( GraphDatabaseSettings.node_auto_indexing.name(), "true" );
        // Now only node properties named propName should be indexed.
        startDb();

        newTransaction();

        Node node1 = graphDb.createNode();
        Node node2 = graphDb.createNode();
        node1.setProperty( "propName", "node1" );
        node2.setProperty( "propName", "node2" );
        node2.setProperty( "propName_", "node2" );

        Relationship rel = node1.createRelationshipTo( node2,
                DynamicRelationshipType.withName( "DYNAMIC" ) );
        rel.setProperty( "propName", "rel1" );

        newTransaction();

        ReadableIndex<Node> autoIndex = graphDb.index().getNodeAutoIndexer().getAutoIndex();
        assertEquals( node1, autoIndex.get( "propName", "node1" ).getSingle() );
        assertEquals( node2, autoIndex.get( "propName", "node2" ).getSingle() );
        assertFalse( graphDb.index().getRelationshipAutoIndexer().getAutoIndex().get(
                "propName", "rel1" ).hasNext() );
    }

    @Test
    public void testDefaultsAreSeparateForNodesAndRelationships()
            throws Exception
    {
        stopDb();
        config = new HashMap<String, String>();
        config.put( GraphDatabaseSettings.node_keys_indexable.name(), "propName" );
        config.put( GraphDatabaseSettings.node_auto_indexing.name(), "true" );
        // Now only node properties named propName should be indexed.
        startDb();

        newTransaction();

        Node node1 = graphDb.createNode();
        Node node2 = graphDb.createNode();
        node1.setProperty( "propName", "node1" );
        node2.setProperty( "propName", "node2" );
        node2.setProperty( "propName_", "node2" );

        Relationship rel = node1.createRelationshipTo( node2,
                DynamicRelationshipType.withName( "DYNAMIC" ) );
        rel.setProperty( "propName", "rel1" );

        newTransaction();

        ReadableIndex<Node> autoIndex = graphDb.index().getNodeAutoIndexer().getAutoIndex();
        assertEquals( node1, autoIndex.get( "propName", "node1" ).getSingle() );
        assertEquals( node2, autoIndex.get( "propName", "node2" ).getSingle() );
        assertFalse( graphDb.index().getRelationshipAutoIndexer().getAutoIndex().get(
                "propName", "rel1" ).hasNext() );
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public testDefaultsAreSeparateForNodesAndRelationships() : void from class org.neo4j.index.impl.lucene.TestAutoIndexing


    @Test
    public void testStartStopAutoIndexing() throws Exception
    {
        stopDb();
        config = new HashMap<>();
        config.put( GraphDatabaseSettings.node_keys_indexable.name(), "propName" );
        config.put( GraphDatabaseSettings.node_auto_indexing.name(), "true" );
        // Now only node properties named propName should be indexed.
        startDb();

        AutoIndexer<Node> autoIndexer = graphDb.index().getNodeAutoIndexer();
        assertTrue( autoIndexer.isEnabled() );

        autoIndexer.setEnabled( false );
        assertFalse( autoIndexer.isEnabled() );
        newTransaction();

        Node node1 = graphDb.createNode();
        Node node2 = graphDb.createNode();
        node1.setProperty( "propName", "node" );
        newTransaction();

        assertFalse( autoIndexer.getAutoIndex().get( "nodeProp1", "node1" ).hasNext() );
        autoIndexer.setEnabled( true );
        node2.setProperty( "propName", "node" );

        newTransaction();

        assertEquals( node2,
                autoIndexer.getAutoIndex().get( "propName", "node" ).getSingle() );
    }

    @Test
    public void testStartStopAutoIndexing() throws Exception
    {
        stopDb();
        config = new HashMap<String, String>();
        config.put( GraphDatabaseSettings.node_keys_indexable.name(), "propName" );
        config.put( GraphDatabaseSettings.node_auto_indexing.name(), "true" );
        // Now only node properties named propName should be indexed.
        startDb();

        AutoIndexer<Node> autoIndexer = graphDb.index().getNodeAutoIndexer();
        assertTrue( autoIndexer.isEnabled() );

        autoIndexer.setEnabled( false );
        assertFalse( autoIndexer.isEnabled() );
        newTransaction();

        Node node1 = graphDb.createNode();
        Node node2 = graphDb.createNode();
        node1.setProperty( "propName", "node" );
        newTransaction();

        assertFalse( autoIndexer.getAutoIndex().get( "nodeProp1", "node1" ).hasNext() );
        autoIndexer.setEnabled( true );
        node2.setProperty( "propName", "node" );

        newTransaction();

        assertEquals( node2,
                autoIndexer.getAutoIndex().get( "propName", "node" ).getSingle() );
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public testStartStopAutoIndexing() : void from class org.neo4j.index.impl.lucene.TestAutoIndexing


    protected Node[] getNodes( String... names )
    {
        Node[] nodes = {};
        ArrayList<Node> result = new ArrayList<>();
        for (String name : names)
        {
            result.add( getNode( name ) );
        }
        return result.toArray(nodes);
    }

    protected Node[] getNodes( String... names )
    {
        Node[] nodes = {};
        ArrayList<Node> result = new ArrayList<Node>();
        for (String name : names)
        {
            result.add( getNode( name ) );
        }
        return result.toArray(nodes);
    }

Replace Generic With Diamond ArrayList<Node> with ArrayList<> in method protected getNodes(names String...) : Node[] from class org.neo4j.server.rest.AbstractRestFunctionalTestBase


    private void expectNodes( String entity, Node... nodes )
            throws PropertyValueException
    {
        Set<String> expected = new HashSet<>();
        for ( Node node : nodes )
        {
            expected.add( getNodeUri( node ) );
        }
        Collection<?> items = (Collection<?>) JsonHelper.jsonToSingleValue( entity );
        for ( Object item : items )
        {
            Map<?, ?> map = (Map<?, ?>) item;
            String uri = (String) map.get( "self" );
            assertTrue( uri + " not found", expected.remove( uri ) );
        }
        assertTrue( "Expected not empty:" + expected, expected.isEmpty() );
    }

    private void expectNodes( String entity, Node... nodes )
            throws PropertyValueException
    {
        Set<String> expected = new HashSet<String>();
        for ( Node node : nodes )
        {
            expected.add( getNodeUri( node ) );
        }
        Collection<?> items = (Collection<?>) JsonHelper.jsonToSingleValue( entity );
        for ( Object item : items )
        {
            Map<?, ?> map = (Map<?, ?>) item;
            String uri = (String) map.get( "self" );
            assertTrue( uri + " not found", expected.remove( uri ) );
        }
        assertTrue( "Expected not empty:" + expected, expected.isEmpty() );
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method private expectNodes(entity String, nodes Node...) : void from class org.neo4j.server.rest.TraverserDocIT


    protected Map<String, String> configuration( boolean initialData )
    {
        return new HashMap<>();
    }

    protected Map<String, String> configuration( boolean initialData )
    {
        return new HashMap<String, String>();
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method protected configuration(initialData boolean) : Map<String,String> from class org.neo4j.test.GraphStoreFixture


        <REC extends AbstractBaseRecord, REP extends ConsistencyReport<REC, REP>> RecordCheck<REC, REP> logging(
                RecordCheck<REC, REP> checker )
        {
            return new LoggingChecker<>( checker, log );
        }

        <REC extends AbstractBaseRecord, REP extends ConsistencyReport<REC, REP>> RecordCheck<REC, REP> logging(
                RecordCheck<REC, REP> checker )
        {
            return new LoggingChecker<REC, REP>( checker, log );
        }

Replace Generic With Diamond LoggingChecker<REC,REP> with LoggingChecker<> in method package logging(checker RecordCheck<REC,REP>) : RecordCheck<REC,REP> from class org.neo4j.consistency.checking.full.ExecutionOrderIntegrationTest.LogDecorator


        @SuppressWarnings("unchecked")
        @Override
        public void dispatch( PendingReferenceCheck<T> reporter )
        {
            reference.dispatch( mock( (Class<PendingReferenceCheck<T>>) reporter.getClass(),
                    withSettings().spiedInstance( reporter )
                            .defaultAnswer( new ReporterSpy<>( reference, reporter, log ) ) ) );
        }

        @SuppressWarnings("unchecked")
        @Override
        public void dispatch( PendingReferenceCheck<T> reporter )
        {
            reference.dispatch( mock( (Class<PendingReferenceCheck<T>>) reporter.getClass(),
                    withSettings().spiedInstance( reporter )
                            .defaultAnswer( new ReporterSpy<T>( reference, reporter, log ) ) ) );
        }

Replace Generic With Diamond ReporterSpy<T> with ReporterSpy<> in method public dispatch(reporter PendingReferenceCheck<T>) : void from class org.neo4j.consistency.checking.full.ExecutionOrderIntegrationTest.LoggingReference


        private <T extends AbstractBaseRecord> LoggingReference<T> logging( RecordReference<T> actual )
        {
            return new LoggingReference<>( actual, log );
        }

        private <T extends AbstractBaseRecord> LoggingReference<T> logging( RecordReference<T> actual )
        {
            return new LoggingReference<T>( actual, log );
        }

Replace Generic With Diamond LoggingReference<T> with LoggingReference<> in method private logging(actual RecordReference<T>) : LoggingReference<T> from class org.neo4j.consistency.checking.full.ExecutionOrderIntegrationTest.ComparativeLogging


    private static Collection<DynamicRecord> allocateFromString( String[] array, Iterator<DynamicRecord> recordsToUseFirst,
                                                                 DynamicRecordAllocator recordAllocator )
    {
        List<byte[]> stringsAsBytes = new ArrayList<>();
        int totalBytesRequired = STRING_HEADER_SIZE; // 1b type + 4b array length
        for ( String string : array )
        {
            byte[] bytes = PropertyStore.encodeString( string );
            stringsAsBytes.add( bytes );
            totalBytesRequired += 4/*byte[].length*/ + bytes.length;
        }

        ByteBuffer buf = ByteBuffer.allocate( totalBytesRequired );
        buf.put( PropertyType.STRING.byteValue() );
        buf.putInt( array.length );
        for ( byte[] stringAsBytes : stringsAsBytes )
        {
            buf.putInt( stringAsBytes.length );
            buf.put( stringAsBytes );
        }
        return allocateRecordsFromBytes( buf.array(), recordsToUseFirst, recordAllocator );
    }

    private static Collection<DynamicRecord> allocateFromString( String[] array, Iterator<DynamicRecord> recordsToUseFirst,
                                                                 DynamicRecordAllocator recordAllocator )
    {
        List<byte[]> stringsAsBytes = new ArrayList<byte[]>();
        int totalBytesRequired = STRING_HEADER_SIZE; // 1b type + 4b array length
        for ( String string : array )
        {
            byte[] bytes = PropertyStore.encodeString( string );
            stringsAsBytes.add( bytes );
            totalBytesRequired += 4/*byte[].length*/ + bytes.length;
        }

        ByteBuffer buf = ByteBuffer.allocate( totalBytesRequired );
        buf.put( PropertyType.STRING.byteValue() );
        buf.putInt( array.length );
        for ( byte[] stringAsBytes : stringsAsBytes )
        {
            buf.putInt( stringAsBytes.length );
            buf.put( stringAsBytes );
        }
        return allocateRecordsFromBytes( buf.array(), recordsToUseFirst, recordAllocator );
    }

Replace Generic With Diamond ArrayList<byte[]> with ArrayList<> in method private allocateFromString(array String[], recordsToUseFirst Iterator<DynamicRecord>, recordAllocator DynamicRecordAllocator) : Collection<DynamicRecord> from class org.neo4j.kernel.impl.nioneo.store.DynamicArrayStore


    private static Map<String, String> requiredParams( Map<String, String> params, String path )
    {
        params = new HashMap<>( params );
        params.put( "neo_store", new File( path, "neostore" ).getPath() );
        return params;
    }

    private static Map<String, String> requiredParams( Map<String, String> params, String path )
    {
        params = new HashMap<String, String>( params );
        params.put( "neo_store", new File( path, "neostore" ).getPath() );
        return params;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method private requiredParams(params Map<String,String>, path String) : Map<String,String> from class org.neo4j.kernel.impl.nioneo.store.StoreAccess


    private static Map<String, String> defaultParams()
    {
        Map<String, String> params = new HashMap<>();
        params.put( GraphDatabaseSettings.nodestore_mapped_memory_size.name(), "20M" );
        params.put( GraphDatabaseSettings.nodestore_propertystore_mapped_memory_size.name(), "90M" );
        params.put( GraphDatabaseSettings.nodestore_propertystore_index_mapped_memory_size.name(), "1M" );
        params.put( GraphDatabaseSettings.nodestore_propertystore_index_keys_mapped_memory_size.name(), "1M" );
        params.put( GraphDatabaseSettings.strings_mapped_memory_size.name(), "130M" );
        params.put( GraphDatabaseSettings.arrays_mapped_memory_size.name(), "130M" );
        params.put( GraphDatabaseSettings.relationshipstore_mapped_memory_size.name(), "100M" );
        // if on windows, default no memory mapping
        if ( osIsWindows() )
        {
            params.put( GraphDatabaseSettings.use_memory_mapped_buffers.name(), "false" );
        }
        params.put( GraphDatabaseSettings.rebuild_idgenerators_fast.name(), Settings.TRUE );
        return params;
    }

    private static Map<String, String> defaultParams()
    {
        Map<String, String> params = new HashMap<String, String>();
        params.put( GraphDatabaseSettings.nodestore_mapped_memory_size.name(), "20M" );
        params.put( GraphDatabaseSettings.nodestore_propertystore_mapped_memory_size.name(), "90M" );
        params.put( GraphDatabaseSettings.nodestore_propertystore_index_mapped_memory_size.name(), "1M" );
        params.put( GraphDatabaseSettings.nodestore_propertystore_index_keys_mapped_memory_size.name(), "1M" );
        params.put( GraphDatabaseSettings.strings_mapped_memory_size.name(), "130M" );
        params.put( GraphDatabaseSettings.arrays_mapped_memory_size.name(), "130M" );
        params.put( GraphDatabaseSettings.relationshipstore_mapped_memory_size.name(), "100M" );
        // if on windows, default no memory mapping
        if ( osIsWindows() )
        {
            params.put( GraphDatabaseSettings.use_memory_mapped_buffers.name(), "false" );
        }
        params.put( GraphDatabaseSettings.rebuild_idgenerators_fast.name(), Settings.TRUE );
        return params;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method private defaultParams() : Map<String,String> from class org.neo4j.kernel.impl.nioneo.store.StoreAccess


    private Set<DynamicRecord> used( Set<DynamicRecord> reallocatedRecords )
    {
        Set<DynamicRecord> used = new HashSet<>();
        for ( DynamicRecord record : reallocatedRecords )
            if ( record.inUse() )
                used.add( record );
        return used;
    }

    private Set<DynamicRecord> used( Set<DynamicRecord> reallocatedRecords )
    {
        Set<DynamicRecord> used = new HashSet<DynamicRecord>();
        for ( DynamicRecord record : reallocatedRecords )
            if ( record.inUse() )
                used.add( record );
        return used;
    }

Replace Generic With Diamond HashSet<DynamicRecord> with HashSet<> in method private used(reallocatedRecords Set<DynamicRecord>) : Set<DynamicRecord> from class org.neo4j.kernel.impl.nioneo.xa.NodeLabelsFieldTest


    private static Map<RecordType, ConcurrentMap<Long, DynamicOwner>> initialize( DynamicStore[] stores )
    {
        EnumMap<RecordType, ConcurrentMap<Long, DynamicOwner>> map =
                new EnumMap<>( RecordType.class );
        for ( DynamicStore store : stores )
        {
            map.put( store.type, new ConcurrentHashMap<Long, DynamicOwner>( 16, 0.75f, 4 ) );
        }
        return unmodifiableMap( map );
    }

    private static Map<RecordType, ConcurrentMap<Long, DynamicOwner>> initialize( DynamicStore[] stores )
    {
        EnumMap<RecordType, ConcurrentMap<Long, DynamicOwner>> map =
                new EnumMap<RecordType, ConcurrentMap<Long, DynamicOwner>>( RecordType.class );
        for ( DynamicStore store : stores )
        {
            map.put( store.type, new ConcurrentHashMap<Long, DynamicOwner>( 16, 0.75f, 4 ) );
        }
        return unmodifiableMap( map );
    }

Replace Generic With Diamond EnumMap<RecordType,ConcurrentMap<Long,DynamicOwner>> with EnumMap<> in method private initialize(stores DynamicStore[]) : Map<RecordType,ConcurrentMap<Long,DynamicOwner>> from class org.neo4j.consistency.checking.full.OwnerCheck


    void scanForOrphanChains( ProgressMonitorFactory progressFactory )
    {
        List<Runnable> tasks = new ArrayList<>();
        ProgressMonitorFactory.MultiPartBuilder progress = progressFactory
                .multipleParts( "Checking for orphan chains" );
        if ( owners != null )
        {
            tasks.add( new OrphanCheck( RecordType.PROPERTY, owners, progress ) );
        }
        if ( dynamics != null )
        {
            for ( Map.Entry<RecordType, ConcurrentMap<Long, DynamicOwner>> entry : dynamics.entrySet() )
            {
                tasks.add( new OrphanCheck( entry.getKey(), entry.getValue(), progress ) );
            }
        }
        for ( Runnable task : tasks )
        {
            task.run();
        }
    }

    void scanForOrphanChains( ProgressMonitorFactory progressFactory )
    {
        List<Runnable> tasks = new ArrayList<Runnable>();
        ProgressMonitorFactory.MultiPartBuilder progress = progressFactory
                .multipleParts( "Checking for orphan chains" );
        if ( owners != null )
        {
            tasks.add( new OrphanCheck( RecordType.PROPERTY, owners, progress ) );
        }
        if ( dynamics != null )
        {
            for ( Map.Entry<RecordType, ConcurrentMap<Long, DynamicOwner>> entry : dynamics.entrySet() )
            {
                tasks.add( new OrphanCheck( entry.getKey(), entry.getValue(), progress ) );
            }
        }
        for ( Runnable task : tasks )
        {
            task.run();
        }
    }

Replace Generic With Diamond ArrayList<Runnable> with ArrayList<> in method package scanForOrphanChains(progressFactory ProgressMonitorFactory) : void from class org.neo4j.consistency.checking.full.OwnerCheck


        public static <T> ProxyFactory<T> create( Class<T> type )
        {
            return new ProxyFactory<>( type );
        }

        public static <T> ProxyFactory<T> create( Class<T> type )
        {
            return new ProxyFactory<T>( type );
        }

Replace Generic With Diamond ProxyFactory<T> with ProxyFactory<> in method public create(type Class<T>) : ProxyFactory<T> from class org.neo4j.consistency.report.ConsistencyReporter.ProxyFactory


    private void loadInitialRelationships( NodeManager nodeManager )
    {
        Triplet<ArrayMap<Integer, RelIdArray>, List<RelationshipImpl>, Long> rels = null;
        synchronized ( this )
        {
            if ( relationships == null )
            {
                try
                {
                    relChainPosition = nodeManager.getRelationshipChainPosition( this );
                }
                catch ( InvalidRecordException e )
                {
                    throw new NotFoundException( asProxy( nodeManager ) +
                            " concurrently deleted while loading its relationships?", e );
                }

                ArrayMap<Integer, RelIdArray> tmpRelMap = new ArrayMap<>();
                rels = getMoreRelationships( nodeManager, tmpRelMap );
                this.relationships = toRelIdArray( tmpRelMap );
                if ( rels != null )
                {
                    setRelChainPosition( rels.third() );
                }
                updateSize( nodeManager );
            }
        }
        if ( rels != null )
        {
            nodeManager.putAllInRelCache( rels.second() );
        }
    }

    private void loadInitialRelationships( NodeManager nodeManager )
    {
        Triplet<ArrayMap<Integer, RelIdArray>, List<RelationshipImpl>, Long> rels = null;
        synchronized ( this )
        {
            if ( relationships == null )
            {
                try
                {
                    relChainPosition = nodeManager.getRelationshipChainPosition( this );
                }
                catch ( InvalidRecordException e )
                {
                    throw new NotFoundException( asProxy( nodeManager ) +
                            " concurrently deleted while loading its relationships?", e );
                }

                ArrayMap<Integer, RelIdArray> tmpRelMap = new ArrayMap<Integer, RelIdArray>();
                rels = getMoreRelationships( nodeManager, tmpRelMap );
                this.relationships = toRelIdArray( tmpRelMap );
                if ( rels != null )
                {
                    setRelChainPosition( rels.third() );
                }
                updateSize( nodeManager );
            }
        }
        if ( rels != null )
        {
            nodeManager.putAllInRelCache( rels.second() );
        }
    }

Replace Generic With Diamond ArrayMap<Integer,RelIdArray> with ArrayMap<> in method private loadInitialRelationships(nodeManager NodeManager) : void from class org.neo4j.kernel.impl.core.NodeImpl


    public synchronized void commitLabels( Set<Long> added, Set<Long> removed )
    {
        if ( labels != null )
        {
            HashSet<Long> newLabels = new HashSet<>( labels );
            if ( added != null )
            {
                newLabels.addAll( added );
            }
            if ( removed != null )
            {
                newLabels.removeAll( removed );
            }
            labels = newLabels;
        }
    }

    public synchronized void commitLabels( Set<Long> added, Set<Long> removed )
    {
        if ( labels != null )
        {
            HashSet<Long> newLabels = new HashSet<Long>( labels );
            if ( added != null )
            {
                newLabels.addAll( added );
            }
            if ( removed != null )
            {
                newLabels.removeAll( removed );
            }
            labels = newLabels;
        }
    }

Replace Generic With Diamond HashSet<Long> with HashSet<> in method public commitLabels(added Set<Long>, removed Set<Long>) : void from class org.neo4j.kernel.impl.core.NodeImpl


    static ArrayMap<Integer, PropertyData> propertyChainToMap(
            Collection<PropertyRecord> chain )
    {
        if ( chain == null )
        {
            return null;
        }
        ArrayMap<Integer, PropertyData> propertyMap = new ArrayMap<>(
                (byte)9, false, true );
        for ( PropertyRecord propRecord : chain )
        {
            for ( PropertyBlock propBlock : propRecord.getPropertyBlocks() )
            {
                propertyMap.put( propBlock.getKeyIndexId(),
                        propBlock.newPropertyData( propRecord ) );
            }
        }
        return propertyMap;
    }

    static ArrayMap<Integer, PropertyData> propertyChainToMap(
            Collection<PropertyRecord> chain )
    {
        if ( chain == null )
        {
            return null;
        }
        ArrayMap<Integer, PropertyData> propertyMap = new ArrayMap<Integer, PropertyData>(
                (byte)9, false, true );
        for ( PropertyRecord propRecord : chain )
        {
            for ( PropertyBlock propBlock : propRecord.getPropertyBlocks() )
            {
                propertyMap.put( propBlock.getKeyIndexId(),
                        propBlock.newPropertyData( propRecord ) );
            }
        }
        return propertyMap;
    }

Replace Generic With Diamond ArrayMap<Integer,PropertyData> with ArrayMap<> in method package propertyChainToMap(chain Collection<PropertyRecord>) : ArrayMap<Integer,PropertyData> from class org.neo4j.kernel.impl.nioneo.xa.ReadTransaction


        @Override
        public Iterator<TO> iterator()
        {
            return new MapIterator<>( from.iterator(), function );
        }

        @Override
        public Iterator<TO> iterator()
        {
            return new MapIterator<FROM, TO>( from.iterator(), function );
        }

Replace Generic With Diamond MapIterator<FROM,TO> with MapIterator<> in method public iterator() : Iterator<TO> from class org.neo4j.helpers.collection.Iterables.MapIterable


        @Override
        public Iterator<T> iterator()
        {
            return new FilterIterator<>( iterable.iterator(), specification );
        }

        @Override
        public Iterator<T> iterator()
        {
            return new FilterIterator<T>( iterable.iterator(), specification );
        }

Replace Generic With Diamond FilterIterator<T> with FilterIterator<> in method public iterator() : Iterator<T> from class org.neo4j.helpers.collection.Iterables.FilterIterable


        @Override
        public Iterator<T> iterator()
        {
            return new FlattenIterator<>( iterable.iterator() );
        }

        @Override
        public Iterator<T> iterator()
        {
            return new FlattenIterator<T, I>( iterable.iterator() );
        }

Replace Generic With Diamond FlattenIterator<T,I> with FlattenIterator<> in method public iterator() : Iterator<T> from class org.neo4j.helpers.collection.Iterables.FlattenIterable


    public static <X> Iterable<X> filter( Predicate<? super X> specification, Iterable<X> i )
    {
        return new FilterIterable<>( i, specification );
    }

    public static <X> Iterable<X> filter( Predicate<? super X> specification, Iterable<X> i )
    {
        return new FilterIterable<X>( i, specification );
    }

Replace Generic With Diamond FilterIterable<X> with FilterIterable<> in method public filter(specification Predicate<? super X>, i Iterable<X>) : Iterable<X> from class org.neo4j.helpers.collection.Iterables


    public static <X> Iterator<X> filter( Predicate<? super X> specification, Iterator<X> i )
    {
        return new FilterIterable.FilterIterator<>( i, specification );
    }

    public static <X> Iterator<X> filter( Predicate<? super X> specification, Iterator<X> i )
    {
        return new FilterIterable.FilterIterator<X>( i, specification );
    }

Replace Generic With Diamond FilterIterable.FilterIterator<X> with FilterIterable.FilterIterator<> in method public filter(specification Predicate<? super X>, i Iterator<X>) : Iterator<X> from class org.neo4j.helpers.collection.Iterables


    public static <X, I extends Iterable<? extends X>> Iterable<X> flatten( I... multiIterator )
    {
        return new FlattenIterable<>( asList(multiIterator) );
    }

    public static <X, I extends Iterable<? extends X>> Iterable<X> flatten( I... multiIterator )
    {
        return new FlattenIterable<X, I>( asList(multiIterator) );
    }

Replace Generic With Diamond FlattenIterable<X,I> with FlattenIterable<> in method public flatten(multiIterator I...) : Iterable<X> from class org.neo4j.helpers.collection.Iterables


    public static <X, I extends Iterable<? extends X>> Iterable<X> flattenIterables( Iterable<I> multiIterator )
    {
        return new FlattenIterable<>( multiIterator );
    }

    public static <X, I extends Iterable<? extends X>> Iterable<X> flattenIterables( Iterable<I> multiIterator )
    {
        return new FlattenIterable<X, I>( multiIterator );
    }

Replace Generic With Diamond FlattenIterable<X,I> with FlattenIterable<> in method public flattenIterables(multiIterator Iterable<I>) : Iterable<X> from class org.neo4j.helpers.collection.Iterables


    public static <FROM, TO> Iterable<TO> map( Function<? super FROM, ? extends TO> function, Iterable<FROM> from )
    {
        return new MapIterable<>( from, function );
    }

    public static <FROM, TO> Iterable<TO> map( Function<? super FROM, ? extends TO> function, Iterable<FROM> from )
    {
        return new MapIterable<FROM, TO>( from, function );
    }

Replace Generic With Diamond MapIterable<FROM,TO> with MapIterable<> in method public map(function Function<? super FROM,? extends TO>, from Iterable<FROM>) : Iterable<TO> from class org.neo4j.helpers.collection.Iterables


    public static <FROM, TO> Iterator<TO> map( Function<? super FROM, ? extends TO> function, Iterator<FROM> from )
    {
        return new MapIterable.MapIterator<>( from, function );
    }

    public static <FROM, TO> Iterator<TO> map( Function<? super FROM, ? extends TO> function, Iterator<FROM> from )
    {
        return new MapIterable.MapIterator<FROM, TO>( from, function );
    }

Replace Generic With Diamond MapIterable.MapIterator<FROM,TO> with MapIterable.MapIterator<> in method public map(function Function<? super FROM,? extends TO>, from Iterator<FROM>) : Iterator<TO> from class org.neo4j.helpers.collection.Iterables


    public static <FROM, TO> Iterator<TO> flatMap( Function<? super FROM, ? extends Iterator<TO>> function, Iterator<FROM> from )
    {
        return new CombiningIterator<>( map(function, from) );
    }

    public static <FROM, TO> Iterator<TO> flatMap( Function<? super FROM, ? extends Iterator<TO>> function, Iterator<FROM> from )
    {
        return new CombiningIterator<TO>( map(function, from) );
    }

Replace Generic With Diamond CombiningIterator<TO> with CombiningIterator<> in method public flatMap(function Function<? super FROM,? extends Iterator<TO>>, from Iterator<FROM>) : Iterator<TO> from class org.neo4j.helpers.collection.Iterables


    public static <T> Iterable<T> iterableEnumeration( Enumeration<T> enumeration )
    {
        List<T> list = new ArrayList<>();
        while ( enumeration.hasMoreElements() )
        {
            T item = enumeration.nextElement();
            list.add( item );
        }

        return list;
    }

    public static <T> Iterable<T> iterableEnumeration( Enumeration<T> enumeration )
    {
        List<T> list = new ArrayList<T>();
        while ( enumeration.hasMoreElements() )
        {
            T item = enumeration.nextElement();
            list.add( item );
        }

        return list;
    }

Replace Generic With Diamond ArrayList<T> with ArrayList<> in method public iterableEnumeration(enumeration Enumeration<T>) : Iterable<T> from class org.neo4j.helpers.collection.Iterables


    public static <T> Iterator<T> concat( Iterator<Iterator<T>> iterators )
    {
        return new CombiningIterator<>(iterators);
    }

    public static <T> Iterator<T> concat( Iterator<Iterator<T>> iterators )
    {
        return new CombiningIterator<T>(iterators);
    }

Replace Generic With Diamond CombiningIterator<T> with CombiningIterator<> in method public concat(iterators Iterator<Iterator<T>>) : Iterator<T> from class org.neo4j.helpers.collection.Iterables


    public static <T> Iterable<T> cache( Iterable<T> iterable )
    {
        return new CacheIterable<>( iterable );
    }

    public static <T> Iterable<T> cache( Iterable<T> iterable )
    {
        return new CacheIterable<T>( iterable );
    }

Replace Generic With Diamond CacheIterable<T> with CacheIterable<> in method public cache(iterable Iterable<T>) : Iterable<T> from class org.neo4j.helpers.collection.Iterables


    /**
     * Returns the iterator's n:th item from the end of the iteration.
     * If the iterator has got less than n-1 items in it {@code null} is returned.
     *
     * @param <T> the type of elements in {@code iterator}.
     * @param iterator the {@link Iterator} to get elements from.
     * @param n the n:th item from the end to get.
     * @return the iterator's n:th item from the end of the iteration,
     * or {@code null} if the iterator doesn't contain that many items.
     */
    public static <T> T fromEndOrNull( Iterator<T> iterator, int n )
    {
        Deque<T> trail = new ArrayDeque<>( n );
        while ( iterator.hasNext() )
        {
            if ( trail.size() > n )
            {
                trail.removeLast();
            }
            trail.addFirst( iterator.next() );
        }
        return trail.size() == n + 1 ? trail.getLast() : null;
    }

    /**
     * Returns the iterator's n:th item from the end of the iteration.
     * If the iterator has got less than n-1 items in it {@code null} is returned.
     *
     * @param <T> the type of elements in {@code iterator}.
     * @param iterator the {@link Iterator} to get elements from.
     * @param n the n:th item from the end to get.
     * @return the iterator's n:th item from the end of the iteration,
     * or {@code null} if the iterator doesn't contain that many items.
     */
    public static <T> T fromEndOrNull( Iterator<T> iterator, int n )
    {
        Deque<T> trail = new ArrayDeque<T>( n );
        while ( iterator.hasNext() )
        {
            if ( trail.size() > n )
            {
                trail.removeLast();
            }
            trail.addFirst( iterator.next() );
        }
        return trail.size() == n + 1 ? trail.getLast() : null;
    }

Replace Generic With Diamond ArrayDeque<T> with ArrayDeque<> in method public fromEndOrNull(iterator Iterator<T>, n int) : T from class org.neo4j.helpers.collection.IteratorUtil


    /**
     * Creates a {@link Set} from an array of items.
     *
     * @param items the items to add to the set.
     * @return the {@link Set} containing the items.
     */
    public static <T> Set<T> asSet( T... items )
    {
        return new HashSet<>( asList( items ) );
    }

    /**
     * Creates a {@link Set} from an array of items.
     *
     * @param items the items to add to the set.
     * @return the {@link Set} containing the items.
     */
    public static <T> Set<T> asSet( T... items )
    {
        return new HashSet<T>( asList( items ) );
    }

Replace Generic With Diamond HashSet<T> with HashSet<> in method public asSet(items T...) : Set<T> from class org.neo4j.helpers.collection.IteratorUtil


    /**
     * Creates a {@link Set} from an array of items.
     *
     * @param items the items to add to the set.
     * @return the {@link Set} containing the items.
     */
    public static <T> Set<T> asUniqueSet( T... items )
    {
        HashSet<T> set = new HashSet<>();
        for ( T item : items )
            addUnique( set, item );
        return set;
    }

    /**
     * Creates a {@link Set} from an array of items.
     *
     * @param items the items to add to the set.
     * @return the {@link Set} containing the items.
     */
    public static <T> Set<T> asUniqueSet( T... items )
    {
        HashSet<T> set = new HashSet<T>();
        for ( T item : items )
            addUnique( set, item );
        return set;
    }

Replace Generic With Diamond HashSet<T> with HashSet<> in method public asUniqueSet(items T...) : Set<T> from class org.neo4j.helpers.collection.IteratorUtil


    /**
     * Creates a {@link Set} from an array of items.
     *
     * @param items the items to add to the set.
     * @return the {@link Set} containing the items.
     */
    public static <T> Set<T> asUniqueSet( Iterator<T> items )
    {
        HashSet<T> set = new HashSet<>();
        while( items.hasNext() )
            addUnique( set, items.next() );
        return set;
    }

    /**
     * Creates a {@link Set} from an array of items.
     *
     * @param items the items to add to the set.
     * @return the {@link Set} containing the items.
     */
    public static <T> Set<T> asUniqueSet( Iterator<T> items )
    {
        HashSet<T> set = new HashSet<T>();
        while( items.hasNext() )
            addUnique( set, items.next() );
        return set;
    }

Replace Generic With Diamond HashSet<T> with HashSet<> in method public asUniqueSet(items Iterator<T>) : Set<T> from class org.neo4j.helpers.collection.IteratorUtil


    private Map<String, CacheProvider> mapCacheProviders( Iterable<CacheProvider> cacheProviders )
    {
        Map<String, CacheProvider> map = new HashMap<>();
        for ( CacheProvider provider : cacheProviders )
        {
            map.put( provider.getName(), provider );
        }
        return map;
    }

    private Map<String, CacheProvider> mapCacheProviders( Iterable<CacheProvider> cacheProviders )
    {
        Map<String, CacheProvider> map = new HashMap<String, CacheProvider>();
        for ( CacheProvider provider : cacheProviders )
        {
            map.put( provider.getName(), provider );
        }
        return map;
    }

Replace Generic With Diamond HashMap<String,CacheProvider> with HashMap<> in method private mapCacheProviders(cacheProviders Iterable<CacheProvider>) : Map<String,CacheProvider> from class org.neo4j.kernel.InternalAbstractGraphDatabase


    private Map<Object, Object> newSchemaStateMap() {
        return new HashMap<>();
    }

    private Map<Object, Object> newSchemaStateMap() {
        return new HashMap<Object, Object>();
    }

Replace Generic With Diamond HashMap<Object,Object> with HashMap<> in method private newSchemaStateMap() : Map<Object,Object> from class org.neo4j.kernel.InternalAbstractGraphDatabase


    private Iterable<Class<?>> getSettingsClasses( Iterable<Class<?>> settingsClasses,
                                                   Iterable<KernelExtensionFactory<?>> kernelExtensions, Iterable
            <CacheProvider> cacheProviders )
    {
        List<Class<?>> totalSettingsClasses = new ArrayList<>();

        // Add given settings classes
        Iterables.addAll( totalSettingsClasses, settingsClasses );

        // Get the list of settings classes for extensions
        for ( KernelExtensionFactory<?> kernelExtension : kernelExtensions )
        {
            if ( kernelExtension.getSettingsClass() != null )
            {
                totalSettingsClasses.add( kernelExtension.getSettingsClass() );
            }
        }

        for ( CacheProvider cacheProvider : cacheProviders )
        {
            if ( cacheProvider.getSettingsClass() != null )
            {
                totalSettingsClasses.add( cacheProvider.getSettingsClass() );
            }
        }

        return totalSettingsClasses;
    }

    private Iterable<Class<?>> getSettingsClasses( Iterable<Class<?>> settingsClasses,
                                                   Iterable<KernelExtensionFactory<?>> kernelExtensions, Iterable
            <CacheProvider> cacheProviders )
    {
        List<Class<?>> totalSettingsClasses = new ArrayList<Class<?>>();

        // Add given settings classes
        Iterables.addAll( totalSettingsClasses, settingsClasses );

        // Get the list of settings classes for extensions
        for ( KernelExtensionFactory<?> kernelExtension : kernelExtensions )
        {
            if ( kernelExtension.getSettingsClass() != null )
            {
                totalSettingsClasses.add( kernelExtension.getSettingsClass() );
            }
        }

        for ( CacheProvider cacheProvider : cacheProviders )
        {
            if ( cacheProvider.getSettingsClass() != null )
            {
                totalSettingsClasses.add( cacheProvider.getSettingsClass() );
            }
        }

        return totalSettingsClasses;
    }

Replace Generic With Diamond ArrayList<Class<?>> with ArrayList<> in method private getSettingsClasses(settingsClasses Iterable<Class<?>>, kernelExtensions Iterable<KernelExtensionFactory<?>>, cacheProviders Iterable<CacheProvider>) : Iterable<Class<?>> from class org.neo4j.kernel.InternalAbstractGraphDatabase


    public DiffSets<T> filterAdded( Predicate<T> addedFilter )
    {
        Iterable<T> newAdded = filter( addedFilter, getAdded() );
        Set<T> newRemoved = getRemoved();
        return new DiffSets<>( asSet( newAdded ), asSet( newRemoved ) );
    }

    public DiffSets<T> filterAdded( Predicate<T> addedFilter )
    {
        Iterable<T> newAdded = filter( addedFilter, getAdded() );
        Set<T> newRemoved = getRemoved();
        return new DiffSets<T>( asSet( newAdded ), asSet( newRemoved ) );
    }

Replace Generic With Diamond DiffSets<T> with DiffSets<> in method public filterAdded(addedFilter Predicate<T>) : DiffSets<T> from class org.neo4j.kernel.impl.api.DiffSets


    private Set<T> newSet()
    {
        return new HashSet<>();
    }

    private Set<T> newSet()
    {
        return new HashSet<T>();
    }

Replace Generic With Diamond HashSet<T> with HashSet<> in method private newSet() : Set<T> from class org.neo4j.kernel.impl.api.DiffSets


    private Iterator<Property> loadAllPropertiesOf( PrimitiveRecord primitiveRecord )
    {
        Collection<PropertyRecord> records = propertyStore.getPropertyRecordChain( primitiveRecord.getNextProp() );
        if ( null == records )
        {
            return IteratorUtil.emptyIterator();
        }
        List<Property> properties = new ArrayList<>();
        for ( PropertyRecord record : records )
        {
            for ( PropertyBlock block : record.getPropertyBlocks() )
            {
                properties.add( block.getType().readProperty( block.getKeyIndexId(), block, propertyStore ) );
            }
        }
        return properties.iterator();
    }

    private Iterator<Property> loadAllPropertiesOf( PrimitiveRecord primitiveRecord )
    {
        Collection<PropertyRecord> records = propertyStore.getPropertyRecordChain( primitiveRecord.getNextProp() );
        if ( null == records )
        {
            return IteratorUtil.emptyIterator();
        }
        List<Property> properties = new ArrayList<Property>();
        for ( PropertyRecord record : records )
        {
            for ( PropertyBlock block : record.getPropertyBlocks() )
            {
                properties.add( block.getType().readProperty( block.getKeyIndexId(), block, propertyStore ) );
            }
        }
        return properties.iterator();
    }

Replace Generic With Diamond ArrayList<Property> with ArrayList<> in method private loadAllPropertiesOf(primitiveRecord PrimitiveRecord) : Iterator<Property> from class org.neo4j.kernel.impl.api.StoreStatementOperations


    public static TypeSafeDiagnosingMatcher<Node> hasLabels( Label... expectedLabels )
    {
        Set<String> labelNames = new HashSet<>( expectedLabels.length );
        for ( Label l : expectedLabels )
        {
            labelNames.add( l.name() );
        }
        return hasLabels( labelNames );
    }

    public static TypeSafeDiagnosingMatcher<Node> hasLabels( Label... expectedLabels )
    {
        Set<String> labelNames = new HashSet<String>( expectedLabels.length );
        for ( Label l : expectedLabels )
        {
            labelNames.add( l.name() );
        }
        return hasLabels( labelNames );
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method public hasLabels(expectedLabels Label...) : TypeSafeDiagnosingMatcher<Node> from class org.neo4j.graphdb.Neo4jMatchers


    @Test
    public void testAdd()
    {
        // GIVEN
        DiffSets<Long> actual = new DiffSets<>();

        // WHEN
        actual.add( 1L );
        actual.add( 2L );

        // THEN
        assertEquals( asSet( 1L, 2L ), actual.getAdded() );
        assertTrue( actual.getRemoved().isEmpty() );
    }

    @Test
    public void testAdd()
    {
        // GIVEN
        DiffSets<Long> actual = new DiffSets<Long>();

        // WHEN
        actual.add( 1L );
        actual.add( 2L );

        // THEN
        assertEquals( asSet( 1L, 2L ), actual.getAdded() );
        assertTrue( actual.getRemoved().isEmpty() );
    }

Replace Generic With Diamond DiffSets<Long> with DiffSets<> in method public testAdd() : void from class org.neo4j.kernel.impl.api.DiffSetsTest


    @Test
    public void testRemove()
    {
        // GIVEN
        DiffSets<Long> actual = new DiffSets<>();

        // WHEN
        actual.add( 1L );
        actual.remove( 2L );

        // THEN
        assertEquals( asSet( 1L ), actual.getAdded() );
        assertEquals( asSet( 2L ), actual.getRemoved() );
    }

    @Test
    public void testRemove()
    {
        // GIVEN
        DiffSets<Long> actual = new DiffSets<Long>();

        // WHEN
        actual.add( 1L );
        actual.remove( 2L );

        // THEN
        assertEquals( asSet( 1L ), actual.getAdded() );
        assertEquals( asSet( 2L ), actual.getRemoved() );
    }

Replace Generic With Diamond DiffSets<Long> with DiffSets<> in method public testRemove() : void from class org.neo4j.kernel.impl.api.DiffSetsTest


    @Test
    public void testAddRemove()
    {
        // GIVEN
        DiffSets<Long> actual = new DiffSets<>();

        // WHEN
        actual.add( 1L );
        actual.remove( 1L );

        // THEN
        assertTrue( actual.getAdded().isEmpty() );
        assertTrue( actual.getRemoved().isEmpty() );
    }

    @Test
    public void testAddRemove()
    {
        // GIVEN
        DiffSets<Long> actual = new DiffSets<Long>();

        // WHEN
        actual.add( 1L );
        actual.remove( 1L );

        // THEN
        assertTrue( actual.getAdded().isEmpty() );
        assertTrue( actual.getRemoved().isEmpty() );
    }

Replace Generic With Diamond DiffSets<Long> with DiffSets<> in method public testAddRemove() : void from class org.neo4j.kernel.impl.api.DiffSetsTest


    @Test
    public void testRemoveAdd()
    {
        // GIVEN
        DiffSets<Long> actual = new DiffSets<>();

        // WHEN
        actual.remove( 1L );
        actual.add( 1L );

        // THEN
        assertEquals( asSet( 1L ), actual.getAdded() );
        assertTrue( actual.getRemoved().isEmpty() );
    }

    @Test
    public void testRemoveAdd()
    {
        // GIVEN
        DiffSets<Long> actual = new DiffSets<Long>();

        // WHEN
        actual.remove( 1L );
        actual.add( 1L );

        // THEN
        assertEquals( asSet( 1L ), actual.getAdded() );
        assertTrue( actual.getRemoved().isEmpty() );
    }

Replace Generic With Diamond DiffSets<Long> with DiffSets<> in method public testRemoveAdd() : void from class org.neo4j.kernel.impl.api.DiffSetsTest


    @Test
    public void testIsAddedOrRemoved()
    {
        // GIVEN
        DiffSets<Long> actual = new DiffSets<>();

        // WHEN
        actual.add( 1L );
        actual.remove( 10L );

        // THEN
        assertTrue( actual.isAdded( 1L ) );
        assertTrue( !actual.isAdded( 2L ) );
        assertTrue( actual.isRemoved( 10L ) );
        assertTrue( !actual.isRemoved( 2L ) );
    }

    @Test
    public void testIsAddedOrRemoved()
    {
        // GIVEN
        DiffSets<Long> actual = new DiffSets<Long>();

        // WHEN
        actual.add( 1L );
        actual.remove( 10L );

        // THEN
        assertTrue( actual.isAdded( 1L ) );
        assertTrue( !actual.isAdded( 2L ) );
        assertTrue( actual.isRemoved( 10L ) );
        assertTrue( !actual.isRemoved( 2L ) );
    }

Replace Generic With Diamond DiffSets<Long> with DiffSets<> in method public testIsAddedOrRemoved() : void from class org.neo4j.kernel.impl.api.DiffSetsTest


    @Test
    public void testAddRemoveAll()
    {
        // GIVEN
        DiffSets<Long> actual = new DiffSets<>();

        // WHEN
        actual.addAll( iterator( 1L, 2L ) );
        actual.removeAll( iterator( 2L, 3L ) );

        // THEN
        assertEquals( asSet( 1L ), actual.getAdded() );
        assertEquals( asSet( 3L ), actual.getRemoved() );
    }

    @Test
    public void testAddRemoveAll()
    {
        // GIVEN
        DiffSets<Long> actual = new DiffSets<Long>();

        // WHEN
        actual.addAll( iterator( 1L, 2L ) );
        actual.removeAll( iterator( 2L, 3L ) );

        // THEN
        assertEquals( asSet( 1L ), actual.getAdded() );
        assertEquals( asSet( 3L ), actual.getRemoved() );
    }

Replace Generic With Diamond DiffSets<Long> with DiffSets<> in method public testAddRemoveAll() : void from class org.neo4j.kernel.impl.api.DiffSetsTest


    @Test
    public void testFilterAdded()
    {
        // GIVEN
        DiffSets<Long> actual = new DiffSets<>();
        actual.addAll( iterator( 1L, 2L ) );
        actual.removeAll( iterator( 3L, 4L ) );

        // WHEN
        DiffSets<Long> filtered = actual.filterAdded( ODD_FILTER );

        // THEN
        assertEquals( asSet( 1L ), filtered.getAdded() );
        assertEquals( asSet( 3L, 4L ), filtered.getRemoved() );
    }

    @Test
    public void testFilterAdded()
    {
        // GIVEN
        DiffSets<Long> actual = new DiffSets<Long>();
        actual.addAll( iterator( 1L, 2L ) );
        actual.removeAll( iterator( 3L, 4L ) );

        // WHEN
        DiffSets<Long> filtered = actual.filterAdded( ODD_FILTER );

        // THEN
        assertEquals( asSet( 1L ), filtered.getAdded() );
        assertEquals( asSet( 3L, 4L ), filtered.getRemoved() );
    }

Replace Generic With Diamond DiffSets<Long> with DiffSets<> in method public testFilterAdded() : void from class org.neo4j.kernel.impl.api.DiffSetsTest


    @Test
    public void testAppendAddedToSourceInApply() throws Exception
    {
        // GIVEN
        DiffSets<Long> diffSets = new DiffSets<>();
        diffSets.add( 52l );
        diffSets.remove( 43l );

        // WHEN
        Iterator<Long> result = diffSets.apply( asList( 18l ).iterator() );

        // THEN
        assertEquals( asList( 18l, 52l ), asCollection( result ) );

    }

    @Test
    public void testAppendAddedToSourceInApply() throws Exception
    {
        // GIVEN
        DiffSets<Long> diffSets = new DiffSets<Long>();
        diffSets.add( 52l );
        diffSets.remove( 43l );

        // WHEN
        Iterator<Long> result = diffSets.apply( asList( 18l ).iterator() );

        // THEN
        assertEquals( asList( 18l, 52l ), asCollection( result ) );

    }

Replace Generic With Diamond DiffSets<Long> with DiffSets<> in method public testAppendAddedToSourceInApply() : void from class org.neo4j.kernel.impl.api.DiffSetsTest


    @Test
    public void testFilterRemovedFromSourceInApply() throws Exception
    {
        // GIVEN
        DiffSets<Long> diffSets = new DiffSets<>();
        diffSets.remove( 43l );

        // WHEN
        Iterator<Long> result = diffSets.apply( asList( 42l, 43l, 44l ).iterator() );

        // THEN
        assertEquals( asList( 42l, 44l ), asCollection( result ) );

    }

    @Test
    public void testFilterRemovedFromSourceInApply() throws Exception
    {
        // GIVEN
        DiffSets<Long> diffSets = new DiffSets<Long>();
        diffSets.remove( 43l );

        // WHEN
        Iterator<Long> result = diffSets.apply( asList( 42l, 43l, 44l ).iterator() );

        // THEN
        assertEquals( asList( 42l, 44l ), asCollection( result ) );

    }

Replace Generic With Diamond DiffSets<Long> with DiffSets<> in method public testFilterRemovedFromSourceInApply() : void from class org.neo4j.kernel.impl.api.DiffSetsTest


    @Test
    public void testFilterAddedFromSourceInApply() throws Exception
    {
        // GIVEN
        DiffSets<Long> diffSets = new DiffSets<>();
        diffSets.add( 42l );
        diffSets.add( 44l );

        // WHEN
        Iterator<Long> result = diffSets.apply( asList( 42l, 43l ).iterator() );

        // THEN
        assertEquals( asList( 43l, 42l, 44l ), asCollection( result ) );

    }

    @Test
    public void testFilterAddedFromSourceInApply() throws Exception
    {
        // GIVEN
        DiffSets<Long> diffSets = new DiffSets<Long>();
        diffSets.add( 42l );
        diffSets.add( 44l );

        // WHEN
        Iterator<Long> result = diffSets.apply( asList( 42l, 43l ).iterator() );

        // THEN
        assertEquals( asList( 43l, 42l, 44l ), asCollection( result ) );

    }

Replace Generic With Diamond DiffSets<Long> with DiffSets<> in method public testFilterAddedFromSourceInApply() : void from class org.neo4j.kernel.impl.api.DiffSetsTest


    private Iterable<NodePropertyUpdate> convertIntoLogicalPropertyUpdates()
    {
        Collection<NodePropertyUpdate> updates = new ArrayList<>();

        gatherUpdatesFromPropertyCommands( updates );
        gatherUpdatesFromNodeCommands( updates );

        return updates;
    }

    private Iterable<NodePropertyUpdate> convertIntoLogicalPropertyUpdates()
    {
        Collection<NodePropertyUpdate> updates = new ArrayList<NodePropertyUpdate>();

        gatherUpdatesFromPropertyCommands( updates );
        gatherUpdatesFromNodeCommands( updates );

        return updates;
    }

Replace Generic With Diamond ArrayList<NodePropertyUpdate> with ArrayList<> in method private convertIntoLogicalPropertyUpdates() : Iterable<NodePropertyUpdate> from class org.neo4j.kernel.impl.nioneo.xa.WriteTransaction


    private ArrayMap<Integer, PropertyData> getAndDeletePropertyChain( PrimitiveRecord primitive )
    {
        ArrayMap<Integer, PropertyData> result = new ArrayMap<>( (byte) 9, false, true );
        long nextProp = primitive.getNextProp();
        while ( nextProp != Record.NO_NEXT_PROPERTY.intValue() )
        {
            RecordChange<Long, PropertyRecord, PrimitiveRecord> propertyChange =
                    propertyRecords.getOrLoad( nextProp, primitive );

            // TODO forChanging/forReading piggy-backing
            PropertyRecord propRecord = propertyChange.forChangingData();
            PropertyRecord before = propertyChange.getBefore();
            for ( PropertyBlock block : before.getPropertyBlocks() )
            {
                result.put( block.getKeyIndexId(), block.newPropertyData( propRecord,
                                                                          propertyGetValueOrNull( block ) ) );
            }
            for ( PropertyBlock block : propRecord.getPropertyBlocks() )
            {
                for ( DynamicRecord valueRecord : block.getValueRecords() )
                {
                    assert valueRecord.inUse();
                    valueRecord.setInUse( false );
                    propRecord.addDeletedRecord( valueRecord );
                }
            }
            nextProp = propRecord.getNextProp();
            propRecord.setInUse( false );
            propRecord.setChanged( primitive );
            // We do not remove them individually, but all together here
            propRecord.getPropertyBlocks().clear();
        }
        return result;
    }

    private ArrayMap<Integer, PropertyData> getAndDeletePropertyChain( PrimitiveRecord primitive )
    {
        ArrayMap<Integer, PropertyData> result = new ArrayMap<Integer, PropertyData>( (byte) 9, false, true );
        long nextProp = primitive.getNextProp();
        while ( nextProp != Record.NO_NEXT_PROPERTY.intValue() )
        {
            RecordChange<Long, PropertyRecord, PrimitiveRecord> propertyChange =
                    propertyRecords.getOrLoad( nextProp, primitive );

            // TODO forChanging/forReading piggy-backing
            PropertyRecord propRecord = propertyChange.forChangingData();
            PropertyRecord before = propertyChange.getBefore();
            for ( PropertyBlock block : before.getPropertyBlocks() )
            {
                result.put( block.getKeyIndexId(), block.newPropertyData( propRecord,
                                                                          propertyGetValueOrNull( block ) ) );
            }
            for ( PropertyBlock block : propRecord.getPropertyBlocks() )
            {
                for ( DynamicRecord valueRecord : block.getValueRecords() )
                {
                    assert valueRecord.inUse();
                    valueRecord.setInUse( false );
                    propRecord.addDeletedRecord( valueRecord );
                }
            }
            nextProp = propRecord.getNextProp();
            propRecord.setInUse( false );
            propRecord.setChanged( primitive );
            // We do not remove them individually, but all together here
            propRecord.getPropertyBlocks().clear();
        }
        return result;
    }

Replace Generic With Diamond ArrayMap<Integer,PropertyData> with ArrayMap<> in method private getAndDeletePropertyChain(primitive PrimitiveRecord) : ArrayMap<Integer,PropertyData> from class org.neo4j.kernel.impl.nioneo.xa.WriteTransaction


    void addRelationshipTypeRecord( RelationshipTypeTokenRecord record )
    {
        if ( relationshipTypeTokenRecords == null )
        {
            relationshipTypeTokenRecords = new HashMap<>();
        }
        relationshipTypeTokenRecords.put( record.getId(), record );
    }

    void addRelationshipTypeRecord( RelationshipTypeTokenRecord record )
    {
        if ( relationshipTypeTokenRecords == null )
        {
            relationshipTypeTokenRecords = new HashMap<Integer, RelationshipTypeTokenRecord>();
        }
        relationshipTypeTokenRecords.put( record.getId(), record );
    }

Replace Generic With Diamond HashMap<Integer,RelationshipTypeTokenRecord> with HashMap<> in method package addRelationshipTypeRecord(record RelationshipTypeTokenRecord) : void from class org.neo4j.kernel.impl.nioneo.xa.WriteTransaction


    void addLabelIdRecord( LabelTokenRecord record )
    {
        if ( labelTokenRecords == null )
        {
            labelTokenRecords = new HashMap<>();
        }
        labelTokenRecords.put( record.getId(), record );
    }

    void addLabelIdRecord( LabelTokenRecord record )
    {
        if ( labelTokenRecords == null )
        {
            labelTokenRecords = new HashMap<Integer, LabelTokenRecord>();
        }
        labelTokenRecords.put( record.getId(), record );
    }

Replace Generic With Diamond HashMap<Integer,LabelTokenRecord> with HashMap<> in method package addLabelIdRecord(record LabelTokenRecord) : void from class org.neo4j.kernel.impl.nioneo.xa.WriteTransaction


    void addPropertyKeyTokenRecord( PropertyKeyTokenRecord record )
    {
        if ( propertyKeyTokenRecords == null )
        {
            propertyKeyTokenRecords = new HashMap<>();
        }
        propertyKeyTokenRecords.put( record.getId(), record );
    }

    void addPropertyKeyTokenRecord( PropertyKeyTokenRecord record )
    {
        if ( propertyKeyTokenRecords == null )
        {
            propertyKeyTokenRecords = new HashMap<Integer, PropertyKeyTokenRecord>();
        }
        propertyKeyTokenRecords.put( record.getId(), record );
    }

Replace Generic With Diamond HashMap<Integer,PropertyKeyTokenRecord> with HashMap<> in method package addPropertyKeyTokenRecord(record PropertyKeyTokenRecord) : void from class org.neo4j.kernel.impl.nioneo.xa.WriteTransaction


    private boolean assertPropertyChain( PrimitiveRecord primitive )
    {
        List<PropertyRecord> toCheck = new LinkedList<>();
        long nextIdToFetch = primitive.getNextProp();
        while ( nextIdToFetch != Record.NO_NEXT_PROPERTY.intValue() )
        {
            PropertyRecord propRecord = propertyRecords.getOrLoad( nextIdToFetch, primitive ).forReadingLinkage();
            toCheck.add( propRecord );
            assert propRecord.inUse() : primitive + "->"
                                        + Arrays.toString( toCheck.toArray() );
            nextIdToFetch = propRecord.getNextProp();
        }
        if ( toCheck.isEmpty() )
        {
            assert primitive.getNextProp() == Record.NO_NEXT_PROPERTY.intValue() : primitive;
            return true;
        }
        PropertyRecord first = toCheck.get( 0 );
        PropertyRecord last = toCheck.get( toCheck.size() - 1 );
        assert first.getPrevProp() == Record.NO_PREVIOUS_PROPERTY.intValue() : primitive
                                                                               + "->"
                                                                               + Arrays.toString( toCheck.toArray() );
        assert last.getNextProp() == Record.NO_NEXT_PROPERTY.intValue() : primitive
                                                                          + "->"
                                                                          + Arrays.toString( toCheck.toArray() );
        PropertyRecord current, previous = first;
        for ( int i = 1; i < toCheck.size(); i++ )
        {
            current = toCheck.get( i );
            assert current.getPrevProp() == previous.getId() : primitive
                                                               + "->"
                                                               + Arrays.toString( toCheck.toArray() );
            assert previous.getNextProp() == current.getId() : primitive
                                                               + "->"
                                                               + Arrays.toString( toCheck.toArray() );
            previous = current;
        }
        return true;
    }

    private boolean assertPropertyChain( PrimitiveRecord primitive )
    {
        List<PropertyRecord> toCheck = new LinkedList<PropertyRecord>();
        long nextIdToFetch = primitive.getNextProp();
        while ( nextIdToFetch != Record.NO_NEXT_PROPERTY.intValue() )
        {
            PropertyRecord propRecord = propertyRecords.getOrLoad( nextIdToFetch, primitive ).forReadingLinkage();
            toCheck.add( propRecord );
            assert propRecord.inUse() : primitive + "->"
                                        + Arrays.toString( toCheck.toArray() );
            nextIdToFetch = propRecord.getNextProp();
        }
        if ( toCheck.isEmpty() )
        {
            assert primitive.getNextProp() == Record.NO_NEXT_PROPERTY.intValue() : primitive;
            return true;
        }
        PropertyRecord first = toCheck.get( 0 );
        PropertyRecord last = toCheck.get( toCheck.size() - 1 );
        assert first.getPrevProp() == Record.NO_PREVIOUS_PROPERTY.intValue() : primitive
                                                                               + "->"
                                                                               + Arrays.toString( toCheck.toArray() );
        assert last.getNextProp() == Record.NO_NEXT_PROPERTY.intValue() : primitive
                                                                          + "->"
                                                                          + Arrays.toString( toCheck.toArray() );
        PropertyRecord current, previous = first;
        for ( int i = 1; i < toCheck.size(); i++ )
        {
            current = toCheck.get( i );
            assert current.getPrevProp() == previous.getId() : primitive
                                                               + "->"
                                                               + Arrays.toString( toCheck.toArray() );
            assert previous.getNextProp() == current.getId() : primitive
                                                               + "->"
                                                               + Arrays.toString( toCheck.toArray() );
            previous = current;
        }
        return true;
    }

Replace Generic With Diamond LinkedList<PropertyRecord> with LinkedList<> in method private assertPropertyChain(primitive PrimitiveRecord) : boolean from class org.neo4j.kernel.impl.nioneo.xa.WriteTransaction