java.util.EnumSet.complement()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中java.util.EnumSet.complement()方法的一些代码示例,展示了EnumSet.complement()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EnumSet.complement()方法的具体详情如下:
包路径:java.util.EnumSet
类名称:EnumSet
方法名:complement

EnumSet.complement介绍

[英]Complements the contents of this enum set.
[中]补充此枚举集的内容。

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Creates an enum set filled with all the enum elements of the specified
 * {@code elementType}.
 *
 * @param elementType
 *            the class object for the elements contained.
 * @return an enum set with elements solely from the specified element type.
 * @throws ClassCastException
 *             if the specified element type is not and enum type.
 */
public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType) {
  EnumSet<E> set = noneOf(elementType);
  set.complement();
  return set;
}

代码示例来源:origin: robovm/robovm

/**
 * Creates an enum set. All the contained elements complement those from the
 * specified enum set.
 *
 * @param s
 *            the specified enum set.
 * @return an enum set with all the elements complementary to those from the
 *         specified enum set.
 * @throws NullPointerException
 *             if {@code s} is {@code null}.
 */
public static <E extends Enum<E>> EnumSet<E> complementOf(EnumSet<E> s) {
  EnumSet<E> set = EnumSet.noneOf(s.elementClass);
  set.addAll(s);
  set.complement();
  return set;
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * Creates an enum set with the same element type as the specified enum
 * set, initially containing all the elements of this type that are
 * <i>not</i> contained in the specified set.
 *
 * @param s the enum set from whose complement to initialize this enum set
 * @throws NullPointerException if <tt>s</tt> is null
 */
public static <E extends Enum<E>> EnumSet<E> complementOf(EnumSet<E> s) {
  EnumSet<E> result = copyOf(s);
  result.complement();
  return result;
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * Creates an enum set with the same element type as the specified enum
 * set, initially containing all the elements of this type that are
 * <i>not</i> contained in the specified set.
 *
 * @param s the enum set from whose complement to initialize this enum set
 * @throws NullPointerException if <tt>s</tt> is null
 */
public static <E extends Enum<E>> EnumSet<E> complementOf(EnumSet<E> s) {
  EnumSet<E> result = copyOf(s);
  result.complement();
  return result;
}

代码示例来源:origin: MobiVM/robovm

/**
 * Creates an enum set filled with all the enum elements of the specified
 * {@code elementType}.
 *
 * @param elementType
 *            the class object for the elements contained.
 * @return an enum set with elements solely from the specified element type.
 * @throws ClassCastException
 *             if the specified element type is not and enum type.
 */
public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType) {
  EnumSet<E> set = noneOf(elementType);
  set.complement();
  return set;
}

代码示例来源:origin: ibinti/bugvm

/**
 * Creates an enum set filled with all the enum elements of the specified
 * {@code elementType}.
 *
 * @param elementType
 *            the class object for the elements contained.
 * @return an enum set with elements solely from the specified element type.
 * @throws ClassCastException
 *             if the specified element type is not and enum type.
 */
public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType) {
  EnumSet<E> set = noneOf(elementType);
  set.complement();
  return set;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Creates an enum set filled with all the enum elements of the specified
 * {@code elementType}.
 *
 * @param elementType
 *            the class object for the elements contained.
 * @return an enum set with elements solely from the specified element type.
 * @throws ClassCastException
 *             if the specified element type is not and enum type.
 */
public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType) {
  EnumSet<E> set = noneOf(elementType);
  set.complement();
  return set;
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Creates an enum set filled with all the enum elements of the specified
 * {@code elementType}.
 *
 * @param elementType
 *            the class object for the elements contained.
 * @return an enum set with elements solely from the specified element type.
 * @throws ClassCastException
 *             if the specified element type is not and enum type.
 */
public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType) {
  EnumSet<E> set = noneOf(elementType);
  set.complement();
  return set;
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Creates an enum set filled with all the enum elements of the specified
 * {@code elementType}.
 *
 * @param elementType
 *            the class object for the elements contained.
 * @return an enum set with elements solely from the specified element type.
 * @throws ClassCastException
 *             if the specified element type is not and enum type.
 */
public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType) {
  EnumSet<E> set = noneOf(elementType);
  set.complement();
  return set;
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Creates an enum set filled with all the enum elements of the specified
 * {@code elementType}.
 *
 * @param elementType
 *            the class object for the elements contained.
 * @return an enum set with elements solely from the specified element type.
 * @throws ClassCastException
 *             if the specified element type is not and enum type.
 */
public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType) {
  EnumSet<E> set = noneOf(elementType);
  set.complement();
  return set;
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * Creates an enum set filled with all the enum elements of the specified
 * {@code elementType}.
 *
 * @param elementType
 *            the class object for the elements contained.
 * @return an enum set with elements solely from the specified element type.
 * @throws ClassCastException
 *             if the specified element type is not and enum type.
 */
public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType) {
  EnumSet<E> set = noneOf(elementType);
  set.complement();
  return set;
}

代码示例来源:origin: MobiVM/robovm

/**
 * Creates an enum set. All the contained elements complement those from the
 * specified enum set.
 *
 * @param s
 *            the specified enum set.
 * @return an enum set with all the elements complementary to those from the
 *         specified enum set.
 * @throws NullPointerException
 *             if {@code s} is {@code null}.
 */
public static <E extends Enum<E>> EnumSet<E> complementOf(EnumSet<E> s) {
  EnumSet<E> set = EnumSet.noneOf(s.elementClass);
  set.addAll(s);
  set.complement();
  return set;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Creates an enum set. All the contained elements complement those from the
 * specified enum set.
 *
 * @param s
 *            the specified enum set.
 * @return an enum set with all the elements complementary to those from the
 *         specified enum set.
 * @throws NullPointerException
 *             if {@code s} is {@code null}.
 */
public static <E extends Enum<E>> EnumSet<E> complementOf(EnumSet<E> s) {
  EnumSet<E> set = EnumSet.noneOf(s.elementClass);
  set.addAll(s);
  set.complement();
  return set;
}

代码示例来源:origin: ibinti/bugvm

/**
 * Creates an enum set. All the contained elements complement those from the
 * specified enum set.
 *
 * @param s
 *            the specified enum set.
 * @return an enum set with all the elements complementary to those from the
 *         specified enum set.
 * @throws NullPointerException
 *             if {@code s} is {@code null}.
 */
public static <E extends Enum<E>> EnumSet<E> complementOf(EnumSet<E> s) {
  EnumSet<E> set = EnumSet.noneOf(s.elementClass);
  set.addAll(s);
  set.complement();
  return set;
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Creates an enum set. All the contained elements complement those from the
 * specified enum set.
 *
 * @param s
 *            the specified enum set.
 * @return an enum set with all the elements complementary to those from the
 *         specified enum set.
 * @throws NullPointerException
 *             if {@code s} is {@code null}.
 */
public static <E extends Enum<E>> EnumSet<E> complementOf(EnumSet<E> s) {
  EnumSet<E> set = EnumSet.noneOf(s.elementClass);
  set.addAll(s);
  set.complement();
  return set;
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Creates an enum set. All the contained elements complement those from the
 * specified enum set.
 *
 * @param s
 *            the specified enum set.
 * @return an enum set with all the elements complementary to those from the
 *         specified enum set.
 * @throws NullPointerException
 *             if {@code s} is {@code null}.
 */
public static <E extends Enum<E>> EnumSet<E> complementOf(EnumSet<E> s) {
  EnumSet<E> set = EnumSet.noneOf(s.elementClass);
  set.addAll(s);
  set.complement();
  return set;
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Creates an enum set. All the contained elements complement those from the
 * specified enum set.
 *
 * @param s
 *            the specified enum set.
 * @return an enum set with all the elements complementary to those from the
 *         specified enum set.
 * @throws NullPointerException
 *             if {@code s} is {@code null}.
 */
public static <E extends Enum<E>> EnumSet<E> complementOf(EnumSet<E> s) {
  EnumSet<E> set = EnumSet.noneOf(s.elementClass);
  set.addAll(s);
  set.complement();
  return set;
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * Creates an enum set. All the contained elements complement those from the
 * specified enum set.
 *
 * @param s
 *            the specified enum set.
 * @return an enum set with all the elements complementary to those from the
 *         specified enum set.
 * @throws NullPointerException
 *             if {@code s} is {@code null}.
 */
public static <E extends Enum<E>> EnumSet<E> complementOf(EnumSet<E> s) {
  EnumSet<E> set = EnumSet.noneOf(s.elementClass);
  set.addAll(s);
  set.complement();
  return set;
}

相关文章