本文整理匯總了Java中java.util.EnumSet.removeAll方法的典型用法代碼示例。如果您正苦於以下問題:Java EnumSet.removeAll方法的具體用法?Java EnumSet.removeAll怎麽用?Java EnumSet.removeAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.EnumSet
的用法示例。
在下文中一共展示了EnumSet.removeAll方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: check
import java.util.EnumSet; //導入方法依賴的package包/類
private boolean check(ElementKind kind, Set<Modifier> modifiers) {
if (this.kind != kind)
return false;
if (modifiers == null || modifiers.isEmpty())
return mods.isEmpty();
if (!modifiers.containsAll(this.mods))
return false;
EnumSet<Modifier> copy = EnumSet.copyOf(modifiers);
copy.removeAll(this.mods);
copy.retainAll(ignoreVisibility? EnumSet.of(Modifier.STATIC)
: EnumSet.of(Modifier.STATIC, Modifier.PUBLIC, Modifier.PRIVATE, Modifier.PROTECTED));
return copy.isEmpty();
}
示例2: build
import java.util.EnumSet; //導入方法依賴的package包/類
/**
* Creates a new {@link ConnectionProfile} based on the added connections.
* @throws IllegalStateException if any of the {@link org.elasticsearch.transport.TransportRequestOptions.Type} enum is missing
*/
public ConnectionProfile build() {
EnumSet<TransportRequestOptions.Type> types = EnumSet.allOf(TransportRequestOptions.Type.class);
types.removeAll(addedTypes);
if (types.isEmpty() == false) {
throw new IllegalStateException("not all types are added for this connection profile - missing types: " + types);
}
return new ConnectionProfile(Collections.unmodifiableList(handles), offset, connectTimeout, handshakeTimeout);
}
示例3: assertSetOfTypesIsEqual
import java.util.EnumSet; //導入方法依賴的package包/類
/**
* Asserts the the set of rsa given are equal.
*
* @param message A detail message to record if the assertion fails.
* @param expected A list of expected condition rsa.
* @param actual A set of condition rsa to compare against the ones expected.
*/
public static void assertSetOfTypesIsEqual(
final String message, final List<String> expected, final EnumSet<CryptoConditionType> actual
) {
final EnumSet<CryptoConditionType> expectedSet = CryptoConditionType
.getEnumOfTypesFromString(String.join(",", expected.toArray(new String[expected.size()])));
if (!expectedSet.containsAll(actual)) {
throw new AssertionError(message + " - expected does not contain all values from actual.");
}
expectedSet.removeAll(actual);
if (!expectedSet.isEmpty()) {
throw new AssertionError(message + " - expected contains values not in actual.");
}
}
示例4: makeComplementByHand
import java.util.EnumSet; //導入方法依賴的package包/類
private static <E extends Enum<E>> EnumSet<E> makeComplementByHand(
Collection<E> collection, Class<E> type) {
EnumSet<E> result = EnumSet.allOf(type);
result.removeAll(collection);
return result;
}