Here you can find the source of isNotEmpty(List extends CharSequence> input)
public static boolean isNotEmpty(List<? extends CharSequence> input)
//package com.java2s; /* ======================================================================== * PlantUML : a free UML diagram generator * ======================================================================== * * (C) Copyright 2009-2017, Arnaud Roques * * Project Info: http://plantuml.com/*from w w w. ja v a 2 s . c o m*/ * * This file is part of PlantUML. * * Licensed under The MIT License (Massachusetts Institute of Technology License) * * See http://opensource.org/licenses/MIT * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * Original Author: Arnaud Roques */ import java.util.List; public class Main { public static boolean isNotEmpty(String input) { return input != null && trin(input).length() > 0; } public static boolean isNotEmpty(List<? extends CharSequence> input) { return input != null && input.size() > 0; } public static String trin(CharSequence arg) { if (arg.length() == 0) { return arg.toString(); } int i = 0; while (i < arg.length() && isSpaceOrTab(arg.charAt(i))) { i++; } int j = arg.length() - 1; while (j >= i && isSpaceOrTab(arg.charAt(j))) { j--; } if (i == 0 && j == arg.length() - 1) { return arg.toString(); } return arg.subSequence(i, j + 1).toString(); } private static boolean isSpaceOrTab(char c) { return c == ' ' || c == '\t'; } }