ch.lambdaj.Lambda.join()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(411)

本文整理了Java中ch.lambdaj.Lambda.join()方法的一些代码示例,展示了Lambda.join()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lambda.join()方法的具体详情如下:
包路径:ch.lambdaj.Lambda
类名称:Lambda
方法名:join

Lambda.join介绍

[英]Joins all the object in the given iterable by concatenating all their String representation. It invokes toString() an all the objects and concatening them using the default separator ", ". Actually it handles also Maps, Arrays and Iterator by collecting their values. Note that this method accepts an Object in order to be used in conjunction with the Lambda#forEach(Iterable).
[中]通过连接给定iterable中的所有对象的字符串表示形式来连接它们。它将调用toString()函数,并使用默认分隔符“,”将所有对象关联起来。实际上,它还通过收集映射、数组和迭代器的值来处理它们。请注意,此方法接受一个对象,以便与Lambda#forEach(Iterable)一起使用。

代码示例

代码示例来源:origin: mariofusco/lambdaj

/**
 * Joins all the object in the given iterable by concatenating all their String representation.
 * It invokes toString() an all the objects and concatening them using the default separator ", ". 
 * Actually it handles also Maps, Arrays and Iterator by collecting their values.
 * Note that this method accepts an Object in order to be used in conjunction with the {@link Lambda#forEach(Iterable)}.
 * @param iterable The iterable containing the objects to be joined
 * @return The concatenation of the String representation of all the objects in the given iterable or an empty String if the iterable is null or empty
 */
public static String join(Object iterable) {
  return join(iterable, ", ");
}

代码示例来源:origin: net.serenity-bdd/core

public static <T> void shouldMatch(List<T> items, BeanMatcher... matchers) {
  if (!matches(items, matchers)) {
    throw new AssertionError("Failed to find matching elements for " + join(matchers)
                 + NEW_LINE
                 +"Elements where " + join(items));
  }
}

代码示例来源:origin: net.thucydides/thucydides-core

private String stringFormOf(Object fieldValue) {
  if (Iterable.class.isAssignableFrom(fieldValue.getClass())) {
    return "[" + join(fieldValue) + "]";
  } else {
    return fieldValue.toString();
  }
}

代码示例来源:origin: net.thucydides/thucydides-core

public static <T> void shouldMatch(List<T> items, BeanMatcher... matchers) {
  if (!matches(items, matchers)) {
    throw new AssertionError("Failed to find matching elements for " + join(matchers)
                 + NEW_LINE
                 +"Elements where " + join(items));
  }
}

代码示例来源:origin: net.serenity-bdd/core

private String stringFormOf(Object fieldValue) {
  if (Iterable.class.isAssignableFrom(fieldValue.getClass())) {
    return "[" + join(fieldValue) + "]";
  } else {
    return fieldValue.toString();
  }
}

代码示例来源:origin: org.motechproject/motech-mobileforms-api

public String getFileContent(String fileName, String formGroupName) {
    String xformFilePath = join(asList(XFORMS_FOLDER, formGroupName, fileName), File.separator);
    try {
      return org.apache.commons.io.IOUtils.toString(getClass().getClassLoader().getResourceAsStream(xformFilePath));
    } catch (Exception e) {
      throw new MotechException("Encountered error while loading openxdata forms", e);
    }
  }
}

代码示例来源:origin: net.serenity-bdd/core

private static String mapDescription(Map<String, ? extends Object> map) {
  List<String> propertyTerms = new ArrayList<String>();
  for (String key : map.keySet()) {
    propertyTerms.add(propertyValueOf(key, map.get(key).toString()));
  }
  return join(propertyTerms);
}

代码示例来源:origin: net.thucydides/thucydides-core

private static String mapDescription(Map<String, ? extends Object> map) {
  List<String> propertyTerms = new ArrayList<String>();
  for (String key : map.keySet()) {
    propertyTerms.add(propertyValueOf(key, map.get(key).toString()));
  }
  return join(propertyTerms);
}

代码示例来源:origin: org.motechproject/motech-mobileforms-api

public String getMessage() {
    return "Errors:" + join(convert(formErrors, new Converter<FormError, String>() {
      @Override
      public String convert(FormError formError) {
        return formError.getParameter() + "=" + formError.getError();
      }
    }), "\n");
  }
}

代码示例来源:origin: mariofusco/lambdaj

/**
 * Joins all the object in this iterable by concatenating all their String representation.
 * It invokes toString() an all the objects and concatening them using the default separator ", ".
 * @return The concatenation of the String representation of all the objects in the given iterable or an empty String if the iterable is null or empty
 */
public String join() {
  return Lambda.join(getInner());
}

代码示例来源:origin: mariofusco/lambdaj

/**
 * Joins all the object in this iterable by concatenating all their String representation.
 * It invokes toString() an all the objects and concatening them using the given separator.
 * Note that this method accepts an Object in order to be used in conjunction with the {@link Lambda#forEach(Iterable)}.
 * @param separator The String used to separe the item's String representation
 * @return The concatenation of the String representation of all the objects in the given iterable or an empty String if the iterable is null or empty
 */
public String join(String separator) {
  return Lambda.join(getInner(), separator);
}

代码示例来源:origin: net.thucydides/thucydides-core

@Override
public void describeTo(Description description) {
  description.appendText("a collection of dates containing ");
  List<String> dates = convert(expectedDates, toReadableForm());
  description.appendText("[" + join(dates) + "]");
}

代码示例来源:origin: net.serenity-bdd/core

@Override
public void describeTo(Description description) {
  description.appendText("a collection of dates containing ");
  List<String> dates = convert(expectedDates, toReadableForm());
  description.appendText("[" + join(dates) + "]");
}

代码示例来源:origin: net.thucydides/thucydides-core

@Override
public void describeTo(Description description) {
  description.appendText("a collection of dates containing ");
  List<String> dates = convert(expectedDates, toReadableForm());
  description.appendText("[" + join(dates) + "]");
}

代码示例来源:origin: net.serenity-bdd/core

@Override
public void describeTo(Description description) {
  description.appendText("a collection of dates containing ");
  List<String> dates = convert(expectedDates, toReadableForm());
  description.appendText("[" + join(dates) + "]");
}

代码示例来源:origin: lordofthejars/nosql-unit

private static String asString(GenericType genericType) {
  if (genericType.getType() == GenericTypeEnum.COMPOSITE_TYPE) {
    return "<" + join(genericType.getCompositeValues()) + ">";
  }
  return genericType.getValue();
}

代码示例来源:origin: com.lordofthejars/nosqlunit-cassandra

private static String asString(GenericType genericType) {
  if (genericType.getType() == GenericTypeEnum.COMPOSITE_TYPE) {
    return "<" + join(genericType.getCompositeValues()) + ">";
  }
  return genericType.getValue();
}

代码示例来源:origin: net.thucydides/thucydides-core

@Override
public String toString() {
  if (!hasChildren()) {
    return description;
  } else {
    String childDescriptions = join(extract(children, on(TestStep.class).toString()));
    return description + " [" + childDescriptions + "]";
  }
}

代码示例来源:origin: net.serenity-bdd/core

@Override
public String toString() {
  if (!hasChildren()) {
    return description;
  } else {
    String childDescriptions = join(extract(children, on(TestStep.class).toString()));
    return description + " [" + childDescriptions + "]";
  }
}

代码示例来源:origin: net.thucydides/thucydides-core

@Override
public String toString() {
  return getTitle() + ":" + join(extract(testSteps, on(TestStep.class).toString()));
}

相关文章