本文整理汇总了Java中java.util.List.toString方法的典型用法代码示例。如果您正苦于以下问题:Java List.toString方法的具体用法?Java List.toString怎么用?Java List.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.List
的用法示例。
在下文中一共展示了List.toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insertintObject
import java.util.List; //导入方法依赖的package包/类
public void insertintObject() {
StringBuilder sb = new StringBuilder("012345");
List<String> ls = new ArrayList<String>();
ls.add("A"); ls.add("B");
String lsString = ls.toString();
assertEquals( sb.insert(2, ls).toString(), "01"+lsString+"2345");
try {
sb.insert(sb.length()+1, ls);
throw new RuntimeException("Test failed: should have thrown StringIndexOutOfBoundsException");
} catch (StringIndexOutOfBoundsException soob) {
// expected: passed
} catch (Throwable t) {
throw new RuntimeException("Test failed: should have thrown StringIndexOutOfBoundsException, but instead threw:"
+ t);
}
}
示例2: executeHandler
import java.util.List; //导入方法依赖的package包/类
private void executeHandler(boolean success, final TccTransaction currentTransaction,
List<Participant> failList) {
if (success) {
TransactionContextLocal.getInstance().remove();
coordinatorCommand.execute(new CoordinatorAction(CoordinatorActionEnum.DELETE, currentTransaction));
} else {
//获取还没执行的,或者执行失败的
currentTransaction.setParticipants(failList);
coordinatorService.updateParticipant(currentTransaction);
throw new TccRuntimeException(failList.toString());
}
}
示例3: setDataToTable
import java.util.List; //导入方法依赖的package包/类
private void setDataToTable(List<Eat> eats) {
DefaultTableModel df = (DefaultTableModel) jTable1.getModel();
df.getDataVector().removeAllElements();
df.fireTableDataChanged();
for (Eat eat : eats) {
List<String> foods = new ArrayList<>();
for (Food food : eat.getFoods()) {
foods.add(food.getFood());
}
Object[] row = new Object[]{
eat.getId(),
eat.getName(),
foods.toString()
};
df.addRow(row);
}
df.fireTableDataChanged();
}
示例4: addGroupDefinition
import java.util.List; //导入方法依赖的package包/类
public Builder addGroupDefinition(GroupDefinition groupDefinition) {
for (GroupDefinition existingDef : groupDefinitions) {
List<String> existingPrefixes = new ArrayList<>(existingDef.getPrefixes());
existingPrefixes.retainAll(groupDefinition.getPrefixes());
if (!existingPrefixes.isEmpty()) {
throw new IllegalArgumentException(
"Duplicate group prefixes: " + existingPrefixes.toString());
}
}
groupDefinitions.add(groupDefinition);
return this;
}
示例5: getListOfAllFunctions
import java.util.List; //导入方法依赖的package包/类
@RequestMapping(method = RequestMethod.GET, consumes = "text/plain", produces = "text/plain")
public String getListOfAllFunctions(Authentication account) throws ParsingException {
LOG.debug("Printing the list of all functions:\n");
List funcList = dbms.getListOfAllFunctions(account.getName());
String response;
if (funcList.isEmpty()) {
LOG.trace("User " + account.getName() + " has no specified functions");
response = "You have no specified functions for now";
} else {
LOG.trace("List of all functions: " + funcList.toString());
response = funcList.toString();
}
return response;
}
示例6: certificatesToString
import java.util.List; //导入方法依赖的package包/类
private String certificatesToString(X509Certificate[] certificates) {
List<String> result = new ArrayList<>();
for (X509Certificate certificate : certificates) {
result.add(certificate.getSubjectDN() + " " + certificate.getSerialNumber());
}
return result.toString();
}
示例7: getLocationString
import java.util.List; //导入方法依赖的package包/类
private String getLocationString() {
JsonLocation l = parser.getCurrentLocation();
List<String> parts = new ArrayList<>(4);
parts.add("line: " + l.getLineNr());
parts.add("column: " + l.getColumnNr());
if (l.getByteOffset() >= 0) {
parts.add("byte offset: " + l.getByteOffset());
}
return parts.toString();
}
示例8: makeCons
import java.util.List; //导入方法依赖的package包/类
/**
* Appropriately updates tokens, determines address and data tokens, and
* validifies the representation of a given S-Expression, in the form of a
* string list.
*
* @param tokens
*/
private void makeCons(List<String> tokens) {
if (tokens.size() > 0 && Pat.PAREN_OPEN.matches(tokens.get(0))) {
int index = 1;
int dataBegin = 3;
if (Pat.PAREN_OPEN.matches(tokens.get(index))) {
int numClausesOpen = 1;
while (numClausesOpen > 0 && index < tokens.size()) {
index++;
if (Pat.PAREN_OPEN.matches(tokens.get(index))) {
numClausesOpen++;
} else if (Pat.PAREN_CLOSE.matches(tokens.get(index))) {
numClausesOpen--;
}
}
dataBegin = index + 1;
}
index = dataBegin > 3 ? ListUtils.subList(tokens, dataBegin, true)
.indexOf(".") + dataBegin : 2;
addrTokens = ListUtils.subList(tokens, 1, index, true);
dataTokens = ListUtils.subList(tokens, index + 1,
tokens.size() - 1, true);
data = NodeFactory.makeNode(dataTokens);
addr = NodeFactory.makeNode(addrTokens);
buildTokens();
return;
}
throw new NodeInitException("Invalid S-Expression provided : "
+ tokens.toString());
}
示例9: isValidConfig
import java.util.List; //导入方法依赖的package包/类
/**
* Validates a csv config file
* @param config CSVConfig object
*/
public static void isValidConfig(CSVConfig config){
//TODO 1. one2one , many2one cannot have supernode
// 2. selfRef is only for same left and right vertex types
// 3. one2many , one2many cannot have more edges than the right vertex
List<String> typeArray = new ArrayList<String>();
config.VertexTypes.forEach(vertextype -> typeArray.add(vertextype.name));
for (EdgeTypeBean edgeType: config.EdgeTypes){
for (RelationBean relation: edgeType.relations) {
//validate left and right are in the vertex types
if(!typeArray.contains(relation.left)){
throw new RuntimeException("relationships: "
+ relation.left + " is not of vertex types: " + typeArray.toString());}
if(!typeArray.contains(relation.right))
throw new RuntimeException("relationships: "
+ relation.right + " is not of vertex types: " + typeArray.toString());
//validate supernode vertices don't exceed the number of vertices
Iterator<VertexTypeBean> vTypes = config.VertexTypes.iterator();
while (vTypes.hasNext()){
VertexTypeBean type = vTypes.next();
if (relation.left.equals(type.name) &&
relation.supernode != null &&
relation.supernode.get("vertices") > type.row){
ObjectMapper mapper = new ObjectMapper();
try {
mapper.writeValueAsString(relation);
throw new RuntimeException(
mapper.writeValueAsString(relation) +
"supernode.vertices is greater than " +
type.name + "'s row"
);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
}
}
}
}
}
示例10: test
import java.util.List; //导入方法依赖的package包/类
void test() {
List<? extends @A Object> o = null;
o.toString();
@A String m;
if (false) {
@A String a;
@A String b = "m";
b.toString();
List<? extends @A Object> c = null;
c.toString();
}
}
示例11: checkForRemainingPlaceholders
import java.util.List; //导入方法依赖的package包/类
private void checkForRemainingPlaceholders(String output) {
List<String> remainingPlaceHolders = new ArrayList<>();
Matcher matcher = placeholderPattern.matcher(output);
while (matcher.find()) {
for (int i = 0; i <= matcher.groupCount(); i++) {
if (i > 0) {
remainingPlaceHolders.add(matcher.group(i));
}
}
}
if (!remainingPlaceHolders.isEmpty()) {
throw new ReplacementsMissingException(remainingPlaceHolders.toString());
}
}
示例12: getManyToOnelinkIdString
import java.util.List; //导入方法依赖的package包/类
@Override
public String getManyToOnelinkIdString() {
List<String> newList = new ArrayList<String>();
List<String> linkList = toArrayManyToOnelink();
for (String element : linkList) {
newList.add("\"" + element + "\"");
}
return newList.toString();
}
示例13: compare
import java.util.List; //导入方法依赖的package包/类
@Override
public int compare(List<String> o1, List<String> o2) {
if(o1.size() < 4 || o2.size() < 4){
throw new IllegalArgumentException(o1.toString());
}
int c = 0;
for(int num : new int[]{1,2,0,4,3}){
c = o1.get(num).compareTo(o2.get(num));
if (c != 0) break;
}
return c;
}
示例14: formatFeatureSet
import java.util.List; //导入方法依赖的package包/类
protected static String formatFeatureSet(Set<? extends Feature<?>> features) {
List<String> temp = new ArrayList<String>();
for (Feature<?> feature : features) {
Object featureAsObject = feature; // to work around bogus JDK warning
if (featureAsObject instanceof Enum) {
Enum<?> f = (Enum<?>) featureAsObject;
temp.add(f.getDeclaringClass().getSimpleName() + "." + feature);
} else {
temp.add(feature.toString());
}
}
return temp.toString();
}
示例15: toString
import java.util.List; //导入方法依赖的package包/类
@Override
public String toString() {
try {
List<Symbol> tmp = Model.this.getSymbols();
return tmp.toString();
} catch (ClingoException ex) {
throw new RuntimeException(ex.getMessage(), ex);
}
}