本文整理汇总了Java中java.util.AbstractCollection.iterator方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractCollection.iterator方法的具体用法?Java AbstractCollection.iterator怎么用?Java AbstractCollection.iterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.AbstractCollection
的用法示例。
在下文中一共展示了AbstractCollection.iterator方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: translate
import java.util.AbstractCollection; //导入方法依赖的package包/类
@Override
public Parameter[] translate(AbstractCollection<T> value) throws TranslationException {
Parameter[] parameters = new Parameter[value.size()];
int i = 0;
Iterator<T> it = value.iterator();
Translator translator = Translator.getInstance();
while (it.hasNext()) {
Parameter[] translation = translator.translate2Parameter(it.next());
if (translation.length == 1) {
// Translations into single parameters are unwrapped.
parameters[i] = translation[0];
} else {
parameters[i] = new ParameterList(translation);
}
i++;
}
return new Parameter[] { new ParameterList(parameters) };
}
示例2: 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();
}
示例3: joinStr
import java.util.AbstractCollection; //导入方法依赖的package包/类
public <E> String joinStr(AbstractCollection<E> list, String delim) {
StringBuffer buf = new StringBuffer();
Iterator<E> iterator = list.iterator();
while (iterator.hasNext()) {
if (buf.length() != 0)
buf.append(delim);
buf.append(iterator.next().toString());
}
return buf.toString();
}
示例4: 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();
}
示例5: 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();
}
示例6: 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();
}