@Test void iteratorAsSet() { // GIVEN PrimitiveIntIterator items = PrimitiveIntCollections.iterator( 1, 2, 3 ); // WHEN PrimitiveIntSet set = PrimitiveIntCollections.asSet( items ); // THEN assertTrue( set.contains( 1 ) ); assertTrue( set.contains( 2 ) ); assertTrue( set.contains( 3 ) ); assertFalse( set.contains( 4 ) ); assertThrows( IllegalStateException.class, () -> PrimitiveIntCollections.asSet( PrimitiveIntCollections.iterator( 1, 2, 1 ) ) ); }
private void validateNodeProperties( long id, int label, int[] requiredKeys, PrimitiveIntSet propertyKeyIds ) throws NodePropertyExistenceException { for ( int key : requiredKeys ) { if ( !propertyKeyIds.contains( key ) ) { failNode( id, label, key ); } } }
return property -> !blackListed.contains( property );
if ( !propertyKeyIds.contains( mandatory ) )
private void validateNodeProperties( long id, PrimitiveIntSet labelIds, PrimitiveIntSet propertyKeyIds ) throws NodePropertyExistenceException { if ( labelIds.size() > mandatoryNodePropertiesByLabel.size() ) { for ( PrimitiveIntIterator labels = mandatoryNodePropertiesByLabel.iterator(); labels.hasNext(); ) { int label = labels.next(); if ( labelIds.contains( label ) ) { validateNodeProperties( id, label, mandatoryNodePropertiesByLabel.get( label ), propertyKeyIds ); } } } else { for ( PrimitiveIntIterator labels = labelIds.iterator(); labels.hasNext(); ) { int label = labels.next(); int[] keys = mandatoryNodePropertiesByLabel.get( label ); if ( keys != null ) { validateNodeProperties( id, label, keys, propertyKeyIds ); } } } }