java快速重复字符串

走着路睡觉
  • java
小于 1 分钟

JDK

String str = "abc";
String repeated = str.repeat(3);

repeated.equals("abcabcabc");

Guava

List<String> l1 = Lists.newArrayList(anotherListOrCollection);    
List<String> l2 = Lists.newArrayList(aStringArray);              
List<String> l3 = Lists.newArrayList("or", "string", "elements");
上次编辑于:
贡献者: zhaojingbo
Loading...