/** * Creates an enum set containing all the elements within the range defined * by {@code start} and {@code end} (inclusive). All the elements must be in * order. * * @param start * the element used to define the beginning of the range. * @param end * the element used to define the end of the range. * @return an enum set with elements in the range from start to end. * @throws NullPointerException * if any one of {@code start} or {@code end} is {@code null}. * @throws IllegalArgumentException * if {@code start} is behind {@code end}. */ public static <E extends Enum<E>> EnumSet<E> range(E start, E end) { if (start.compareTo(end) > 0) { throw new IllegalArgumentException("start is behind end"); } EnumSet<E> set = EnumSet.noneOf(start.getDeclaringClass()); set.setRange(start, end); return set; }
/** * Creates an enum set containing all the elements within the range defined * by {@code start} and {@code end} (inclusive). All the elements must be in * order. * * @param start * the element used to define the beginning of the range. * @param end * the element used to define the end of the range. * @return an enum set with elements in the range from start to end. * @throws NullPointerException * if any one of {@code start} or {@code end} is {@code null}. * @throws IllegalArgumentException * if {@code start} is behind {@code end}. */ public static <E extends Enum<E>> EnumSet<E> range(E start, E end) { if (start.compareTo(end) > 0) { throw new IllegalArgumentException("start is behind end"); } EnumSet<E> set = EnumSet.noneOf(start.getDeclaringClass()); set.setRange(start, end); return set; }
/** * Creates an enum set containing all the elements within the range defined * by {@code start} and {@code end} (inclusive). All the elements must be in * order. * * @param start * the element used to define the beginning of the range. * @param end * the element used to define the end of the range. * @return an enum set with elements in the range from start to end. * @throws NullPointerException * if any one of {@code start} or {@code end} is {@code null}. * @throws IllegalArgumentException * if {@code start} is behind {@code end}. */ public static <E extends Enum<E>> EnumSet<E> range(E start, E end) { if (start.compareTo(end) > 0) { throw new IllegalArgumentException("start is behind end"); } EnumSet<E> set = EnumSet.noneOf(start.getDeclaringClass()); set.setRange(start, end); return set; }
/** * Creates an enum set containing all the elements within the range defined * by {@code start} and {@code end} (inclusive). All the elements must be in * order. * * @param start * the element used to define the beginning of the range. * @param end * the element used to define the end of the range. * @return an enum set with elements in the range from start to end. * @throws NullPointerException * if any one of {@code start} or {@code end} is {@code null}. * @throws IllegalArgumentException * if {@code start} is behind {@code end}. */ public static <E extends Enum<E>> EnumSet<E> range(E start, E end) { if (start.compareTo(end) > 0) { throw new IllegalArgumentException("start is behind end"); } EnumSet<E> set = EnumSet.noneOf(start.getDeclaringClass()); set.setRange(start, end); return set; }
/** * Creates an enum set containing all the elements within the range defined * by {@code start} and {@code end} (inclusive). All the elements must be in * order. * * @param start * the element used to define the beginning of the range. * @param end * the element used to define the end of the range. * @return an enum set with elements in the range from start to end. * @throws NullPointerException * if any one of {@code start} or {@code end} is {@code null}. * @throws IllegalArgumentException * if {@code start} is behind {@code end}. */ public static <E extends Enum<E>> EnumSet<E> range(E start, E end) { if (start.compareTo(end) > 0) { throw new IllegalArgumentException("start is behind end"); } EnumSet<E> set = EnumSet.noneOf(start.getDeclaringClass()); set.setRange(start, end); return set; }
/** * Creates an enum set containing all the elements within the range defined * by {@code start} and {@code end} (inclusive). All the elements must be in * order. * * @param start * the element used to define the beginning of the range. * @param end * the element used to define the end of the range. * @return an enum set with elements in the range from start to end. * @throws NullPointerException * if any one of {@code start} or {@code end} is {@code null}. * @throws IllegalArgumentException * if {@code start} is behind {@code end}. */ public static <E extends Enum<E>> EnumSet<E> range(E start, E end) { if (start.compareTo(end) > 0) { throw new IllegalArgumentException("start is behind end"); } EnumSet<E> set = EnumSet.noneOf(start.getDeclaringClass()); set.setRange(start, end); return set; }
/** * Creates an enum set containing all the elements within the range defined * by {@code start} and {@code end} (inclusive). All the elements must be in * order. * * @param start * the element used to define the beginning of the range. * @param end * the element used to define the end of the range. * @return an enum set with elements in the range from start to end. * @throws NullPointerException * if any one of {@code start} or {@code end} is {@code null}. * @throws IllegalArgumentException * if {@code start} is behind {@code end}. */ public static <E extends Enum<E>> EnumSet<E> range(E start, E end) { if (start.compareTo(end) > 0) { throw new IllegalArgumentException("start is behind end"); } EnumSet<E> set = EnumSet.noneOf(start.getDeclaringClass()); set.setRange(start, end); return set; }
/** * Creates an enum set containing all the elements within the range defined * by {@code start} and {@code end} (inclusive). All the elements must be in * order. * * @param start * the element used to define the beginning of the range. * @param end * the element used to define the end of the range. * @return an enum set with elements in the range from start to end. * @throws NullPointerException * if any one of {@code start} or {@code end} is {@code null}. * @throws IllegalArgumentException * if {@code start} is behind {@code end}. */ public static <E extends Enum<E>> EnumSet<E> range(E start, E end) { if (start.compareTo(end) > 0) { throw new IllegalArgumentException("start is behind end"); } EnumSet<E> set = EnumSet.noneOf(start.getDeclaringClass()); set.setRange(start, end); return set; }