本文整理汇总了Java中com.google.common.collect.Iterables.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Iterables.toString方法的具体用法?Java Iterables.toString怎么用?Java Iterables.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Iterables
的用法示例。
在下文中一共展示了Iterables.toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: restore
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
/**
* Creates a data source identical to the original.
*
* @throws DataTypeChangedException if the data type of the restored source is different from the saved one
* @throws IllegalStateException if the saved source type is not registered when this method is called
*/
@SuppressWarnings("unchecked")
public DataSource<T> restore() throws DataTypeChangedException, IllegalStateException {
SourceType sourceType = getSourceType();
if (SourceTypes.getDefault().isRegistered(sourceType)) {
DataSource<T> restored = (DataSource<T>) sourceType.forUri(oldId);
if (!possibleTypes.contains(restored.getDataType())) {
throw new DataTypeChangedException(
"The new data type is " + restored.getDataType() + ", was expecting one of: "
+ Iterables.toString(possibleTypes));
}
if (sourceType.getAvailableSourceUris().contains(oldId)) {
// The restored source already existed at restoration time, no need to set its name or data
return restored;
}
restored.nameProperty().set(name.get());
restored.activeProperty().set(true);
if (getData() == null && !Sources.getDefault().isRegistered(restored)) {
// No data was saved, set it to the default value for its type
restored.setData(restored.getDataType().getDefaultValue());
} else {
restored.setData(getData());
}
return restored;
} else {
throw new IllegalStateException("The source type " + sourceType.getName() + " is not registered");
}
}
示例2: getProjectNames
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
private String getProjectNames(final Iterable<IBuildConfiguration> buildOrder) {
return Iterables.toString(from(buildOrder).transform(c -> c.getProject().getName()));
}
示例3: toString
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
@Override
public String toString() {
return super.toString() + " " + Iterables.toString(projectNames);
}