List of usage examples for java.util List isEmpty
boolean isEmpty();
From source file:org.jfrog.teamcity.agent.util.PathMatcher.java
private static boolean matches(String path, String include, List<String> excludes) { if (excludes != null && !excludes.isEmpty()) { for (String exclude : excludes) { boolean match = antPathMatcher.match(exclude, path); if (match) { return false; }/* ww w . ja v a 2 s . c o m*/ } } if (StringUtils.isNotBlank(include)) { boolean match = antPathMatcher.match(include, path); if (match) { return true; } } else { return true; } return false; }
From source file:com.microsoft.alm.common.utils.ArgumentHelper.java
public static void checkNotNullOrEmpty(final List arg, final String argName) { checkNotNull(arg, argName);// w w w . j a v a 2 s . c o m if (arg.isEmpty()) { throw new IllegalArgumentException(String.format(EMPTY_ARG_MSG, argName)); } }
From source file:com.webbfontaine.valuewebb.irms.impl.core.AbstractRuleHandler.java
private static boolean notEmpty(List<Criteria> rules) { return !rules.isEmpty(); }
From source file:Main.java
public static <T> List<T> sub(List<T> list, int start, int end) { if (list == null || list.isEmpty()) { return new ArrayList<>(); }// w w w . ja v a2s .co m if (start < 0) { start = 0; } if (end < 0) { end = 0; } if (start > end) { int tmp = start; start = end; end = tmp; } final int size = list.size(); if (end > size) { if (start >= size) { return new ArrayList<>(); } end = size; } return list.subList(start, end); }
From source file:Main.java
public static AccessibilityNodeInfo findNodeInfosById(AccessibilityNodeInfo nodeInfo, String resId) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { List<AccessibilityNodeInfo> list = nodeInfo.findAccessibilityNodeInfosByViewId(resId); if (list != null && !list.isEmpty()) { return list.get(0); }//from w ww . ja v a 2 s . co m } return null; }
From source file:Main.java
/** * // ww w.jav a 2 s. c o m * @param <T> * @param list * @param comparator * @return */ public static <T> T getLowerMiddleValue(List<T> list, Comparator<T> comparator) { if (null == list || list.isEmpty()) return null; Collections.sort(list, comparator); return list.get((list.size() - 1) / 2); }
From source file:annis.utils.Utils.java
public static String avg(List<Long> runtimeList) { if (runtimeList.isEmpty()) { return ""; }// w w w. j a v a2 s . c o m long sum = 0; for (long value : runtimeList) { sum += value; } return String.valueOf(sum / runtimeList.size()); }
From source file:Main.java
/** * For logging, extremely unnecessary.//from w w w . java 2 s . c om * * @param list * @return */ public static <T> String list2str(List<T> list) { StringBuilder sb = new StringBuilder(); if (list != null && !list.isEmpty()) { sb.append("["); for (T t : list) { sb.append(t.toString()).append(", "); } sb.delete(sb.length() - 2, sb.length()); sb.append("]"); } return sb.toString(); }
From source file:Main.java
public static boolean isApplicationBroughtToBackground(Context context) { List list = ((ActivityManager) context.getSystemService("activity")).getRunningTasks(1); boolean flag; if (!list.isEmpty() && !((android.app.ActivityManager.RunningTaskInfo) list.get(0)).topActivity .getPackageName().equals(context.getPackageName())) flag = true;// ww w . j ava 2s. c om else flag = false; return flag; }
From source file:Main.java
/** * Gets the JDBC URL associated with an active Redshift cluster. * //from w w w .j a va 2 s .c o m * @param client * The {@link AmazonRedshiftClient} with read permissions * @param clusterIdentifier * The unique Redshift cluster identifier * @return JDBC URL for the Redshift cluster */ public static String getClusterURL(AmazonRedshiftClient client, String clusterIdentifier) { DescribeClustersRequest describeClustersRequest = new DescribeClustersRequest(); describeClustersRequest.setClusterIdentifier(clusterIdentifier); DescribeClustersResult describeClustersResult = client.describeClusters(describeClustersRequest); List<Cluster> clusters = describeClustersResult.getClusters(); if (!clusters.isEmpty()) { return toJDBC(clusters.get(0).getEndpoint(), clusters.get(0).getDBName()); } return null; }