本文整理汇总了Java中java.util.StringJoiner.toString方法的典型用法代码示例。如果您正苦于以下问题:Java StringJoiner.toString方法的具体用法?Java StringJoiner.toString怎么用?Java StringJoiner.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.StringJoiner
的用法示例。
在下文中一共展示了StringJoiner.toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getActions
import java.util.StringJoiner; //导入方法依赖的package包/类
/**
* Returns the "canonical string representation" of the actions in the
* specified mask.
* Always returns present actions in the following order:
* connect, listen, accept, resolve.
*
* @param mask a specific integer action mask to translate into a string
* @return the canonical string representation of the actions
*/
private static String getActions(int mask) {
StringJoiner sj = new StringJoiner(",");
if ((mask & CONNECT) == CONNECT) {
sj.add("connect");
}
if ((mask & LISTEN) == LISTEN) {
sj.add("listen");
}
if ((mask & ACCEPT) == ACCEPT) {
sj.add("accept");
}
if ((mask & RESOLVE) == RESOLVE) {
sj.add("resolve");
}
return sj.toString();
}
示例2: asString
import java.util.StringJoiner; //导入方法依赖的package包/类
public String asString() {
StringJoiner resultLineJointer = new StringJoiner("\n");
resultLineJointer.add(new ValueFields(variables, access).asString());
resultLineJointer.add("");
if (access == Access.METHOD) {
createGetter(resultLineJointer);
}
resultLineJointer.add(new Constructor(sourceClass, variables).asString());
resultLineJointer.add("");
variables.stream().filter(variable -> Type.ALL_SUPPORTED_CLASSES_AND_PRIMITIVES.values().contains(variable.getType()))
.forEach(variable -> resultLineJointer.add(new ValueSubClass(variable).asString()));
resultLineJointer.add(createEquals());
resultLineJointer.add(createHashCode());
resultLineJointer.add(createToString());
String complete = resultLineJointer.toString();
return complete;
}
示例3: formatRecipients
import java.util.StringJoiner; //导入方法依赖的package包/类
private String formatRecipients(String[] recipients) {
if (recipients == null){
return null;
}
if (recipients.length == 1) {
return recipients[0];
}
StringJoiner joiner = new StringJoiner(",");
for (CharSequence cs: recipients) {
joiner.add(cs);
}
return joiner.toString();
}
示例4: toString
import java.util.StringJoiner; //导入方法依赖的package包/类
@Override
public String toString() {
StringJoiner sj = new StringJoiner("\n", "policy: ", "");
Enumeration<Permission> perms = permissions.elements();
while (perms.hasMoreElements()) {
sj.add(perms.nextElement().toString());
}
return sj.toString();
}
示例5: if
import java.util.StringJoiner; //导入方法依赖的package包/类
private String toRFC2253StringInternal
(boolean canonical, Map<String, String> oidMap) {
/*
* Section 2.2: When converting from an ASN.1 RelativeDistinguishedName
* to a string, the output consists of the string encodings of each
* AttributeTypeAndValue (according to 2.3), in any order.
*
* Where there is a multi-valued RDN, the outputs from adjoining
* AttributeTypeAndValues are separated by a plus ('+' ASCII 43)
* character.
*/
// normally, an RDN only contains one AVA
if (assertion.length == 1) {
return canonical ? assertion[0].toRFC2253CanonicalString() :
assertion[0].toRFC2253String(oidMap);
}
AVA[] toOutput = assertion;
if (canonical) {
// order the string type AVA's alphabetically,
// followed by the oid type AVA's numerically
toOutput = assertion.clone();
Arrays.sort(toOutput, AVAComparator.getInstance());
}
StringJoiner sj = new StringJoiner("+");
for (AVA ava : toOutput) {
sj.add(canonical ? ava.toRFC2253CanonicalString()
: ava.toRFC2253String(oidMap));
}
return sj.toString();
}
示例6: toString
import java.util.StringJoiner; //导入方法依赖的package包/类
public String toString() {
if (assertion.length == 1) {
return assertion[0].toString();
}
StringJoiner sj = new StringJoiner(" + ");
for (int i = 0; i < assertion.length; i++) {
sj.add(assertion[i].toString());
}
return sj.toString();
}
示例7: asString
import java.util.StringJoiner; //导入方法依赖的package包/类
public String asString() {
StringJoiner resultLineJointer = new StringJoiner("\n");
resultLineJointer.add(getConstructorLine());
variables.stream().map(variable -> variable.getName().getValue())
.forEach(name -> resultLineJointer.add("\tthis." + name + " = " + name + ";"));
resultLineJointer.add("}");
return resultLineJointer.toString();
}
示例8: toString
import java.util.StringJoiner; //导入方法依赖的package包/类
@Override
public String toString() {
String causeString = "Origin[";
StringJoiner joiner = new StringJoiner(", ");
for (int i = 0; i < this.origin.length; i++) {
joiner.add("{Name=" + this.names[i] + ", Object={" + this.origin[i].toString() + "}}");
}
return causeString + joiner.toString() + "]";
}
示例9: toString
import java.util.StringJoiner; //导入方法依赖的package包/类
@Override
public String toString() {
final StringJoiner sj = new StringJoiner(", ", "{ ", " }");
sj.add("id = " + Objects.toString(getId()));
sj.add("username = " + Objects.toString(getUsername()));
sj.add("password = " + Objects.toString(getPassword()));
sj.add("role = " + Objects.toString(getRole()));
return "AccountImpl " + sj.toString();
}
示例10: getActions
import java.util.StringJoiner; //导入方法依赖的package包/类
/**
* Return the canonical string representation of the actions. Always returns
* actions in the following order: watch,preview.
*
* @param mask a specific integer action mask to translate into a string
* @return the canonical string representation of the actions
*/
private synchronized static String getActions(int mask) {
StringJoiner sj = new StringJoiner(",");
if ((mask & WATCH) == WATCH) {
sj.add("watch");
}
if ((mask & PREVIEW) == PREVIEW) {
sj.add("preview");
}
return sj.toString();
}
示例11: toString
import java.util.StringJoiner; //导入方法依赖的package包/类
public String toString() {
StringJoiner sj = new StringJoiner(",", "CalendarBuilder:[", "]");
for (int i = 0; i < field.length; i++) {
if (isSet(i)) {
sj.add(i + "=" + field[MAX_FIELD + i]);
}
}
return sj.toString();
}
示例12: toString
import java.util.StringJoiner; //导入方法依赖的package包/类
/**
* Returns a string representation of {@link SortedAdjacencyList}.
*
* @return String representation.
*/
@Override
public String toString() {
StringJoiner sj = new StringJoiner(", ");
for (int i = 0; i < size; i++) {
sj.add("{" + neighbourIds[i] + ": " + edgeTypes[i] + "}");
}
return "[" + sj.toString() + "]";
}
示例13: fullName
import java.util.StringJoiner; //导入方法依赖的package包/类
/**
* The full name is identified as the concatenation of the first and last name, separated by a space.
* This method can return an empty name if both first and last name are empty.
*
* @return the full name of the user
*/
public String fullName() {
StringJoiner name = new StringJoiner(" ");
if (!isEmpty(firstName))
name.add(firstName);
if (!isEmpty(lastName))
name.add(lastName);
return name.toString();
}
示例14: toString
import java.util.StringJoiner; //导入方法依赖的package包/类
public String toString() {
StringJoiner joiner = new StringJoiner("->");
ListNode n = this;
while (n != null) {
joiner.add(String.valueOf(n.data));
n = n.next;
}
return joiner.toString();
}
示例15: generateRFC1779DN
import java.util.StringJoiner; //导入方法依赖的package包/类
private String generateRFC1779DN(Map<String, String> oidMap) {
if (names.length == 1) {
return names[0].toRFC1779String(oidMap);
}
if (names == null) {
return "";
}
StringJoiner sj = new StringJoiner(", ");
for (int i = names.length - 1; i >= 0; i--) {
sj.add(names[i].toRFC1779String(oidMap));
}
return sj.toString();
}