public boolean isType( CapabilityType type ) { return contains( types, type ); }
private boolean isFlag( String arg ) { return ArrayUtil.contains( flags, arg ); }
/** * Check if array contains item. * * @param array Array to examine * @param contains Single item to look for * @param <T> The type of the array items * @return {@code true} if {@code contains} exists in {@code array}, otherwise {@code false}. */ @Deprecated public static <T> boolean contains( T[] array, T contains ) { return contains( array, array.length, contains ); }
/** * Count items from a different array contained in an array. * The order of items doesn't matter. * * @param array Array to examine * @param contains Items to look for * @param <T> The type of the array items * @return {@code true} if all items in {@code contains} exists in {@code array}, otherwise {@code false}. */ @Deprecated public static <T> boolean containsAll( T[] array, T[] contains ) { for ( T check : contains ) { if ( !contains( array, check ) ) { return false; } } return true; }
/** * Count missing items in an array. * The order of items doesn't matter. * * @param array Array to examine * @param contains Items to look for * @param <T> The type of the array items * @return how many of the items in {@code contains} are missing from {@code array}. */ @Deprecated public static <T> int missing( T[] array, T[] contains ) { int missing = 0; for ( T check : contains ) { if ( !contains( array, check ) ) { missing++; } } return missing; }
@Override public boolean shouldCheck( long id, MultiPassStore store ) { return ArrayUtil.contains( storesToCheck, store ); }
@Override public boolean hasCapability( Capability capability ) { return contains( capabilities(), capability ); }
for ( T candidate : other ) if ( !contains( first, candidate ) )
/** * Returns specified store by type from already opened store array. If store is not opened exception will be * thrown. * * @see #getOrCreateStore * @param storeType store type to retrieve * @return store of requested type * @throws IllegalStateException if opened store not found */ private Object getStore( StoreType storeType ) { Object store = stores[storeType.ordinal()]; if ( store == null ) { String message = ArrayUtil.contains( initializedStores, storeType ) ? STORE_ALREADY_CLOSED_MESSAGE : String.format( STORE_NOT_INITIALIZED_TEMPLATE, storeType.name() ); throw new IllegalStateException( message ); } return store; }
static void validateQuery( IndexCapability capability, IndexOrder indexOrder, IndexQuery[] predicates ) { if ( indexOrder != IndexOrder.NONE ) { ValueCategory valueCategory = predicates[0].valueGroup().category(); IndexOrder[] orderCapability = capability.orderCapability( valueCategory ); if ( !ArrayUtil.contains( orderCapability, indexOrder ) ) { orderCapability = ArrayUtils.add( orderCapability, IndexOrder.NONE ); throw new UnsupportedOperationException( format( "Tried to query index with unsupported order %s. Supported orders for query %s are %s.", indexOrder, Arrays.toString( predicates ), Arrays.toString( orderCapability ) ) ); } } } }
private void closeStoreFile() throws IOException { try { /* * Note: the closing ordering here is important! * It is the case since we wand to mark the id generator as closed cleanly ONLY IF * also the store file is cleanly shutdown. */ if ( pagedFile != null ) { pagedFile.close(); } if ( idGenerator != null ) { if ( contains( openOptions, DELETE_ON_CLOSE ) ) { idGenerator.delete(); } else { idGenerator.close(); } } } finally { pagedFile = null; } }
@Test void shouldRemoveItems() { // GIVEN Integer[] numbers = ArrayUtil.concat( 0, 1, 2, 3, 4, 5 ); // WHEN Integer[] trimmed = ArrayUtil.without( numbers, 2 ); trimmed = ArrayUtil.without( trimmed, 5 ); trimmed = ArrayUtil.without( trimmed, 0 ); // THEN assertEquals( 3, trimmed.length ); assertFalse( ArrayUtil.contains( trimmed, 0 ) ); assertTrue( ArrayUtil.contains( trimmed, 1 ) ); assertFalse( ArrayUtil.contains( trimmed, 2 ) ); assertTrue( ArrayUtil.contains( trimmed, 3 ) ); assertTrue( ArrayUtil.contains( trimmed, 4 ) ); assertFalse( ArrayUtil.contains( trimmed, 5 ) ); }
ArrayUtil.contains( base64chars, character ) );
private static String[] randomLabels( RandomValues random, Distribution<String> labels ) { if ( labels.length() == 0 ) { return NO_LABELS; } int length = random.nextInt( min( 3, labels.length() ) ) + 1; String[] result = new String[length]; for ( int i = 0; i < result.length; ) { String candidate = labels.random( random ); if ( !ArrayUtil.contains( result, i, candidate ) ) { result[i++] = candidate; } } return result; }
assertTrue( value, value == null || ArrayUtil.contains( values, value ) ); tx.success();
public boolean isType( CapabilityType type ) { return contains( types, type ); }
private boolean isFlag( String arg ) { return ArrayUtil.contains( flags, arg ); }
/** * Check if array contains item. * * @param array Array to examine * @param contains Single item to look for * @param <T> The type of the array items * @return {@code true} if {@code contains} exists in {@code array}, otherwise {@code false}. */ @Deprecated public static <T> boolean contains( T[] array, T contains ) { return contains( array, array.length, contains ); }
@Override public boolean hasCapability( Capability capability ) { return contains( capabilities(), capability ); }