本文整理汇总了Java中java.util.AbstractCollection.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractCollection.isEmpty方法的具体用法?Java AbstractCollection.isEmpty怎么用?Java AbstractCollection.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.AbstractCollection
的用法示例。
在下文中一共展示了AbstractCollection.isEmpty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: join
import java.util.AbstractCollection; //导入方法依赖的package包/类
private static String join(AbstractCollection<String> col, String delimiter) {
if (col.isEmpty()) return "";
Iterator<String> iter = col.iterator();
StringBuffer buffer = new StringBuffer(iter.next());
while(iter.hasNext()) buffer.append(delimiter).append(iter.next());
return buffer.toString();
}
示例2: unmarshal
import java.util.AbstractCollection; //导入方法依赖的package包/类
@Override
public Iterable<S> unmarshal(AbstractCollection<S> source) throws Exception {
if (source == null || source.isEmpty()) {
return Collections.emptyList();
}
return source;
}
示例3: join
import java.util.AbstractCollection; //导入方法依赖的package包/类
public static String join(AbstractCollection<String> s, String delimiter) {
if (s.isEmpty()) return "";
Iterator<String> iter = s.iterator();
StringBuffer buffer = new StringBuffer(iter.next());
while (iter.hasNext()) {
buffer.append(delimiter);
buffer.append(iter.next());
}
return buffer.toString();
}
示例4: join
import java.util.AbstractCollection; //导入方法依赖的package包/类
/**
* Join multiple strings into a string delimited by the given delimiter.
*
* @param s a collection of strings
* @param delimiter the delimiter
* @return a 'delimiter' separated string
*/
public static String join(AbstractCollection<String> s, String delimiter) {
if (s.isEmpty()) return "";
Iterator<String> iter = s.iterator();
StringBuffer buffer = new StringBuffer(iter.next());
while (iter.hasNext()) {
buffer.append(delimiter);
buffer.append(iter.next());
}
return buffer.toString();
}
示例5: join
import java.util.AbstractCollection; //导入方法依赖的package包/类
public static String join(AbstractCollection<String> s, String delimiter) {
if (s == null || s.isEmpty())
return "";
Iterator<String> iter = s.iterator();
StringBuilder builder = new StringBuilder(iter.next());
while (iter.hasNext()) {
builder.append(delimiter).append(iter.next());
}
return builder.toString();
}