當前位置: 首頁>>代碼示例>>Java>>正文


Java StringJoiner.toString方法代碼示例

本文整理匯總了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();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:SocketPermission.java

示例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;
}
 
開發者ID:Ingwersaft,項目名稱:ValueClassGenerator,代碼行數:18,代碼來源:ValueClass.java

示例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();
    }
 
開發者ID:aksalj,項目名稱:africastalking-java,代碼行數:17,代碼來源:SmsService.java

示例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();

}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:11,代碼來源:JAXPPolicyManager.java

示例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();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:33,代碼來源:RDN.java

示例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();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:RDN.java

示例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();
}
 
開發者ID:Ingwersaft,項目名稱:ValueClassGenerator,代碼行數:9,代碼來源:Constructor.java

示例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() + "]";
}
 
開發者ID:ichorpowered,項目名稱:guardianapi,代碼行數:10,代碼來源:Origin.java

示例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();
}
 
開發者ID:Pyknic,項目名稱:speedment-secure-rest-example,代碼行數:10,代碼來源:GeneratedAccountImpl.java

示例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();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:18,代碼來源:TVPermission.java

示例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();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:CalendarBuilder.java

示例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() + "]";
}
 
開發者ID:graphflow,項目名稱:graphflow,代碼行數:14,代碼來源:SortedAdjacencyList.java

示例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();
}
 
開發者ID:addo37,項目名稱:AbilityBots,代碼行數:17,代碼來源:EndUser.java

示例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();
}
 
開發者ID:xy1m,項目名稱:PlayGround,代碼行數:10,代碼來源:ListNode.java

示例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();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:16,代碼來源:X500Name.java


注:本文中的java.util.StringJoiner.toString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。