@SafeVarargs @SuppressWarnings( "unchecked" ) public static <T> Iterator<T> concat( Iterator<? extends T>... iterators ) { return concat( Arrays.asList( (Iterator<T>[]) iterators ).iterator() ); }
@Override public Iterator<Document> iterator() { Iterator<Iterator<Document>> iterators = partitionReaders.stream() .map( LucenePartitionAllDocumentsReader::iterator ) .collect( toList() ) .iterator(); return Iterators.concat( iterators ); }
@Override public Iterator<T> apply( Iterator<? extends T> source ) { Iterator<T> result = (Iterator) source; if ( (removedElements != null && !removedElements.isEmpty()) || (addedElements != null && !addedElements.isEmpty()) ) { ensureFilterHasBeenCreated(); result = Iterators.filter( filter, result ); } if ( addedElements != null && !addedElements.isEmpty() ) { result = Iterators.concat( result, addedElements.iterator() ); } return result; }
/** * Sorts indexes by type, returning first GENERAL indexes, followed by UNIQUE. Implementation is not suitable in * hot path. * * @param indexes Indexes to sort * @return sorted indexes */ static Iterator<IndexReference> sortByType( Iterator<IndexReference> indexes ) { List<IndexReference> materialized = Iterators.asList( indexes ); return Iterators.concat( Iterators.filter( i -> !i.isUnique(), materialized.iterator() ), Iterators.filter( IndexReference::isUnique, materialized.iterator() ) ); }
@Override public Iterator<StorageProperty> addedAndChangedProperties() { if ( addedProperties == null ) { return toPropertyIterator( changedProperties ); } if ( changedProperties == null ) { return toPropertyIterator( addedProperties ); } return Iterators.concat( toPropertyIterator( addedProperties ), toPropertyIterator( changedProperties ) ); }
when( tokens.relationshipTypesGetAllTokens() ).thenAnswer( asTokens( relTypes ) ); when( schemaRead.indexesGetAll() ).thenAnswer( i -> Iterators.concat( indexes.iterator(), uniqueIndexes.iterator() ) ); when( schemaRead.index( any( SchemaDescriptor.class ) ) ).thenAnswer( (Answer<IndexReference>) invocationOnMock -> { SchemaDescriptor schema = invocationOnMock.getArgument( 0 );
@SafeVarargs @SuppressWarnings( "unchecked" ) public static <T> Iterator<T> concat( Iterator<? extends T>... iterators ) { return concat( Arrays.asList( (Iterator<T>[]) iterators ).iterator() ); }
@Override public Iterator<T> apply( Iterator<? extends T> source ) { Iterator<T> result = (Iterator) source; if ( (removedElements != null && !removedElements.isEmpty()) || (addedElements != null && !addedElements.isEmpty()) ) { ensureFilterHasBeenCreated(); result = Iterators.filter( filter, result ); } if ( addedElements != null && !addedElements.isEmpty() ) { result = Iterators.concat( result, addedElements.iterator() ); } return result; }
/** * Sorts indexes by type, returning first GENERAL indexes, followed by UNIQUE. Implementation is not suitable in * hot path. * * @param indexes Indexes to sort * @return sorted indexes */ static Iterator<IndexReference> sortByType( Iterator<IndexReference> indexes ) { List<IndexReference> materialized = Iterators.asList( indexes ); return Iterators.concat( Iterators.filter( i -> !i.isUnique(), materialized.iterator() ), Iterators.filter( IndexReference::isUnique, materialized.iterator() ) ); }
@Override public Iterator<StorageProperty> addedAndChangedProperties() { if ( addedProperties == null ) { return toPropertyIterator( changedProperties ); } if ( changedProperties == null ) { return toPropertyIterator( addedProperties ); } return Iterators.concat( toPropertyIterator( addedProperties ), toPropertyIterator( changedProperties ) ); }