List of usage examples for java.util List isEmpty
boolean isEmpty();
From source file:grails.plugins.sitemapper.ValidationUtils.java
public static void assertDataObjectsAttr(List<PageMapDataObjectAttr> attrs) { if (attrs == null || attrs.isEmpty()) throw new SitemapperException("Data object attributes can not be null or empty"); }
From source file:com.ufukuzun.myth.dialect.util.ExpressionUtils.java
public static boolean isDollarExpression(String value) { List<String> idFragments = splitIdFragments(value); return !idFragments.isEmpty() && idFragments.size() == 1 && idFragments.get(0).matches(DOLLAR_EXPRESSION_PATTERN.pattern()); }
From source file:io.milton.httpclient.RespUtils.java
public static boolean hasChild(Element el, String name) { if (el == null) return false; List<Element> list = getElements(el, name); return !list.isEmpty(); }
From source file:net.przemkovv.sphinx.Utils.java
public static void cleanupFilesystem(List<File> files) { if (files != null && !files.isEmpty()) { File parent_dir = files.get(0).getParentFile(); for (File file : files) { file.delete();/*from w w w . ja va2 s. c o m*/ } parent_dir.delete(); } }
From source file:Main.java
public static <T> void addTailAndRemoveOldIfNeed(List<T> dest, List<T> src) { if (dest == null) { return;//from w w w . java 2s . c o m } if (src == null || src.isEmpty()) { return; } removeDuplicate(dest, src); if (dest.isEmpty()) { dest.addAll(src); } else { dest.addAll(dest.size(), src); } }
From source file:de.metas.ui.web.view.json.JSONDocumentViewOrderBy.java
public static List<JSONDocumentViewOrderBy> ofList(final List<DocumentQueryOrderBy> orderBys) { if (orderBys == null || orderBys.isEmpty()) { return ImmutableList.of(); }/* w ww.jav a2 s .c om*/ return orderBys.stream().map(orderBy -> of(orderBy)).filter(jsonOrderBy -> jsonOrderBy != null) .collect(GuavaCollectors.toImmutableList()); }
From source file:edu.cmu.cs.lti.ark.fn.identification.FrameIdentificationRelease.java
public static String getFirstTokenAndCpos(List<Integer> indices, Sentence sentence) { if (indices.isEmpty()) return ""; final Token firstToken = sentence.getTokens().get(indices.get(0)); return firstToken.getForm().toLowerCase() + "." + nullToEmpty(firstToken.getPostag()).substring(0, 1).toLowerCase(); }
From source file:com.example.app.profile.ui.user.LoginLandingLinks.java
private static boolean canAccessMenuLink(MembershipOperation mop, List<Membership> memberships) { if (memberships.isEmpty()) return false; return memberships.stream().anyMatch(m -> m.getOperations().contains(mop)); }
From source file:models.Email.java
public static boolean exists(String newEmail, boolean valid) { ExpressionList<Email> el = findByEmailAndIsValid(newEmail, valid); if (valid) {/*from w w w. ja v a 2s. co m*/ Email uniqueValidatedEmail = el.findUnique(); return uniqueValidatedEmail != null; } else { List<Email> list = el.findList(); return !list.isEmpty(); } }
From source file:Main.java
/** * Creates a list of values extracted from the provided list using the * specified value method, keeping the order of the provided list. *///w w w . j av a 2 s.c om @SuppressWarnings("unchecked") public static <K, T> List<K> createList(List<T> list, String valueMethod) { List<K> valueList = new ArrayList<>(list.size()); if (list.isEmpty()) { return valueList; } Class<?> elementClass = list.iterator().next().getClass(); Method getValueMethod; try { getValueMethod = elementClass.getMethod(valueMethod, new Class[0]); } catch (Exception e) { throw new RuntimeException("Failed to get key method", e); } for (T element : list) { K value; try { value = (K) getValueMethod.invoke(element, (Object[]) null); } catch (Exception e) { throw new RuntimeException("Failed to get key", e); } valueList.add(value); } return valueList; }