Lines Matching defs:list
22 * Various assortment of list utilities.
24 * <p>Using a {@code null} list is supported and will almost always return the default value
29 /** Return {@code} true if the {@code list} contains the {@code needle}. */
30 public static <T> boolean listContains(List<T> list, T needle) {
31 if (list == null) {
34 return list.contains(needle);
39 * Return {@code true} if the {@code list} is only a single element equal to
42 public static <T> boolean listElementsEqualTo(List<T> list, T single) {
43 if (list == null) {
47 return (list.size() == 1 && list.contains(single));
51 * Return a human-readable representation of a list (non-recursively).
53 public static <T> String listToString(List<T> list) {
54 if (list == null) {
61 int size = list.size();
63 for (T elem : list) {
77 * Return the first item from {@code choices} that is contained in the {@code list}.
80 * are in the {@code list}, then {@code null} is returned.
82 * @param list a list of objects which may or may not contain one or more of the choices
85 * @return the first item from {@code choices} contained in {@code list}, otherwise {@code null}
87 public static <T> T listSelectFirstFrom(List<T> list, T[] choices) {
88 if (list == null) {
93 if (list.contains(choice)) {