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


Java Set.toString方法代碼示例

本文整理匯總了Java中java.util.Set.toString方法的典型用法代碼示例。如果您正苦於以下問題:Java Set.toString方法的具體用法?Java Set.toString怎麽用?Java Set.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.Set的用法示例。


在下文中一共展示了Set.toString方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: mergeExportsOrOpens

import java.util.Set; //導入方法依賴的package包/類
private void mergeExportsOrOpens(Statement statement,
                                 Statement extra,
                                 Set<String> modules)
{
    String pn = statement.name;
    if (statement.isUnqualified() && extra.isQualified()) {
        throw new RuntimeException("can't add qualified exports to " +
            "unqualified exports " + pn);
    }

    Set<String> mods = extra.targets.stream()
        .filter(mn -> statement.targets.contains(mn))
        .collect(toSet());
    if (mods.size() > 0) {
        throw new RuntimeException("qualified exports " + pn + " to " +
            mods.toString() + " already declared in " + sourceFile);
    }

    // add qualified exports or opens to known modules only
    addTargets(statement, extra, modules);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:22,代碼來源:GenModuleInfoSource.java

示例2: validateJWT

import java.util.Set; //導入方法依賴的package包/類
/** Do some basic checks on the JWT, until the MP-JWT annotations are ready. */
private void validateJWT() throws JWTException {
  // Make sure the authorization header was present.  This check is somewhat
  // silly since the jwtPrincipal will never actually be null since it's a
  // WELD proxy (injected).
  if (jwtPrincipal == null) {
    throw new JWTException("No authorization header or unable to inflate JWT");
  }

  // Make sure we're in one of the groups we know about.
  Set<String> groups = jwtPrincipal.getGroups();
  if ((groups.contains("users") == false) && (groups.contains("orchestrator") == false)) {
    throw new JWTException("User is not in a valid group [" + groups.toString() + "]");
  }

  // TODO: Additional checks as appropriate.
}
 
開發者ID:OpenLiberty,項目名稱:sample-acmegifts,代碼行數:18,代碼來源:OccasionResource.java

示例3: isRollUpCombinationSupported

import java.util.Set; //導入方法依賴的package包/類
public boolean isRollUpCombinationSupported(final Set<String> rolledUpFieldNames) {
    if (rolledUpFieldNames == null || rolledUpFieldNames.isEmpty()) {
        return true;
    }

    if (rolledUpFieldNames.size() > statisticFields.size()) {
        throw new RuntimeException(
                "isRollUpCombinationSupported called with more rolled up fields (" + rolledUpFieldNames.toString()
                        + ") than there are statistic fields (" + fieldPositionMap.keySet() + ")");
    }

    if (!fieldPositionMap.keySet().containsAll(rolledUpFieldNames)) {
        throw new RuntimeException(
                "isRollUpCombinationSupported called rolled up fields (" + rolledUpFieldNames.toString()
                        + ") that don't exist in the statistic fields list (" + fieldPositionMap.keySet() + ")");
    }

    final List<Integer> rolledUpFieldPositions = new ArrayList<Integer>();
    for (final String rolledUpField : rolledUpFieldNames) {
        rolledUpFieldPositions.add(getFieldPositionInList(rolledUpField));
    }

    return customRollUpMasks.contains(new CustomRollUpMaskEntityObject(rolledUpFieldPositions));
}
 
開發者ID:gchq,項目名稱:stroom-stats,代碼行數:25,代碼來源:StroomStatsStoreEntityData.java

示例4: bindParams

import java.util.Set; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 *
 * @see jp.co.future.uroborosql.context.SqlContext#bindParams(java.sql.PreparedStatement)
 */
@Override
public void bindParams(final PreparedStatement preparedStatement) throws SQLException {
	Parameter[] bindParameters = getBindParameters();

	Set<String> matchParams = new HashSet<>();
	int parameterIndex = 1;
	for (Parameter bindParameter : bindParameters) {
		Parameter parameter = getSqlFilterManager().doParameter(bindParameter);
		parameterIndex = parameter.setParameter(preparedStatement, parameterIndex, parameterMapperManager);
		matchParams.add(parameter.getParameterName());
	}
	// SQL上のバインドパラメータ群(bindNames)に対応する値がすべて設定されているかどうかをチェックする
	if (!matchParams.containsAll(bindNames)) {
		Set<String> missMatchParams = new LinkedHashSet<>(bindNames);
		missMatchParams.removeAll(matchParams);
		throw new ParameterNotFoundRuntimeException("Parameter " + missMatchParams.toString() + " is not bound.");
	}
}
 
開發者ID:future-architect,項目名稱:uroborosql,代碼行數:24,代碼來源:SqlContextImpl.java

示例5: validateJWT

import java.util.Set; //導入方法依賴的package包/類
/** Do some basic checks on the JWT, until the MP-JWT annotations are ready. */
private void validateJWT(Set<String> validGroups) throws JWTException {
  // Make sure the authorization header was present. This check is somewhat
  // silly since the jwtPrincipal will never actually be null since it's a
  // WELD proxy (injected).
  if (jwtPrincipal == null) {
    throw new JWTException("No authorization header or unable to inflate JWT");
  }

  // Make sure we're in one of the groups that is authorized.
  String validatedGroupName = null;
  Set<String> groups = jwtPrincipal.getGroups();
  if (groups != null) {
    for (String group : groups) {
      if (validGroups.contains(group)) {
        validatedGroupName = group;
        break;
      }
    }
  }

  if (validatedGroupName == null) {
    throw new JWTException("User is not in a valid group [" + groups.toString() + "]");
  }
}
 
開發者ID:OpenLiberty,項目名稱:sample-acmegifts,代碼行數:26,代碼來源:UserResource.java

示例6: InvalidOrMissingFieldsException

import java.util.Set; //導入方法依賴的package包/類
public InvalidOrMissingFieldsException(Class<?> entityClass, Map<String,String> illegal, Set<String> missing) {
    super("Unable to process " + entityClass.getName() + " because of " + (illegal == null ? "no" : illegal.size())
            + " illegal "+(illegal != null ? illegal.keySet().toString() : "") 
            + " and " + (missing == null ? "no" : missing.size()) + " missing fields "
            + (missing != null ? missing.toString() : ""));
    this.entityClass = entityClass;
    this.illegal = illegal == null ? Collections.emptyMap() : Collections.unmodifiableMap(illegal);
    this.missing = missing == null ? Collections.emptySet() : Collections.unmodifiableSet(missing);
}
 
開發者ID:redlink-gmbh,項目名稱:smarti,代碼行數:10,代碼來源:InvalidOrMissingFieldsException.java

示例7: checkCNHost

import java.util.Set; //導入方法依賴的package包/類
private void checkCNHost(X509Certificate[] chain, String ip) throws CertificateException {
  if (option.isCheckCNHost()) {
    X509Certificate owner = CertificateUtil.findOwner(chain);
    Set<String> cns = CertificateUtil.getCN(owner);
    String ipTmp = ip == null ? custom.getHost() : ip;
    // 從本機來的請求, 隻要CN與本機的任何一個IP地址匹配即可
    if ("127.0.0.1".equals(ipTmp)) {
      try {
        Enumeration<NetworkInterface> interfaces =
            NetworkInterface.getNetworkInterfaces();
        if (interfaces != null) {
          while (interfaces.hasMoreElements()) {
            NetworkInterface nif = interfaces.nextElement();
            Enumeration<InetAddress> ias = nif.getInetAddresses();
            while (ias.hasMoreElements()) {
              InetAddress ia = ias.nextElement();
              String local = ia.getHostAddress();
              if (cnValid(cns, local)) {
                return;
              }
            }
          }
        }
      } catch (SocketException e) {
        throw new CertificateException("Get local adrress fail.");
      }
    } else if (cnValid(cns, ipTmp)) {
      return;
    }
    LOG.error("CN does not match IP: e=" + cns.toString()
        + ",t=" + ip);
    throw new CertificateException("CN does not match IP: e=" + cns.toString()
        + ",t=" + ip);
  }
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:36,代碼來源:TrustManagerExt.java

示例8: checkForErrors

import java.util.Set; //導入方法依賴的package包/類
/**
 * Check for errors by asking the validator to review each credential.
 *
 * @param credentials the credentials
 */
private void checkForErrors(final Credential... credentials) {
    if (credentials == null) {
        return;
    }

    for (final Credential c : credentials) {
        final Set<ConstraintViolation<Credential>> errors = this.validator.validate(c);
        if (!errors.isEmpty()) {
            throw new IllegalArgumentException("Error validating credentials: " + errors.toString());
        }
    }
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:18,代碼來源:RemoteCentralAuthenticationService.java

示例9: toString

import java.util.Set; //導入方法依賴的package包/類
public String toString(){
	String  s = "[";
	
	for (Set<Integer> set : indices){
		s+="[";
		s+=set.toString();
		s+="], ";
	}
	
	s+="]";
	
	return s;
}
 
開發者ID:HPI-Information-Systems,項目名稱:metanome-algorithms,代碼行數:14,代碼來源:PositionListIndex.java

示例10: jsonExpect

import java.util.Set; //導入方法依賴的package包/類
private void jsonExpect(JsonObject obj, Set<String> fields) throws BinanceApiException {
    Set<String> missing = new HashSet<>();
    for (String f: fields) { if (!obj.has(f) || obj.get(f).isJsonNull()) missing.add(f); }
    if (missing.size() > 0) {
        log.warn("Missing fields {} in {}", missing.toString(), obj.toString());
        throw new BinanceApiException("Missing fields " + missing.toString());
    }
}
 
開發者ID:webcerebrium,項目名稱:java-binance-api,代碼行數:9,代碼來源:BinanceExchangeProduct.java

示例11: testToString

import java.util.Set; //導入方法依賴的package包/類
/**
 * KeySet.toString holds toString of elements
 */
public void testToString() {
    assertEquals("[]", ConcurrentHashMap.newKeySet().toString());
    Set full = populatedSet(3);
    String s = full.toString();
    for (int i = 0; i < 3; ++i)
        assertTrue(s.contains(String.valueOf(i)));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:11,代碼來源:ConcurrentHashMap8Test.java

示例12: checkForErrors

import java.util.Set; //導入方法依賴的package包/類
private void checkForErrors(final Credential... credentials) {
    if (credentials == null) {
        return;
    }

    for (final Credential c : credentials) {
        final Set<ConstraintViolation<Credential>> errors = this.validator.validate(c);
        if (!errors.isEmpty()) {
            throw new IllegalArgumentException("Error validating credentials: " + errors.toString());
        }
    }
}
 
開發者ID:luotuo,項目名稱:cas4.0.x-server-wechat,代碼行數:13,代碼來源:RemoteCentralAuthenticationService.java

示例13: getDiff

import java.util.Set; //導入方法依賴的package包/類
private static String getDiff(Set<String> set1, Set<String> set2) {
    Set<String> s1 = new HashSet<>(set1);
    s1.removeAll(set2);

    Set<String> s2 = new HashSet<>(set2);
    s2.removeAll(set1);
    s2.addAll(s1);
    return s2.toString();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:IDTest.java

示例14: reportDeadLocalVariables

import java.util.Set; //導入方法依賴的package包/類
void reportDeadLocalVariables(String className, MethodNode methodNode,
		Set<LocalVariableNode> localVariables) throws XMLStreamException {
	final Set<String> names = new LinkedHashSet<>(localVariables.size());
	for (final LocalVariableNode localVariable : localVariables) {
		names.add(localVariable.name);
	}
	final String msg = "Local suspects in class " + className + " in method "
			+ getMethodDescription(methodNode) + ':';
	final String msg2 = '\t' + names.toString();
	reportWarning("deadLocalVariable", className, msg, msg2);
}
 
開發者ID:evernat,項目名稱:dead-code-detector,代碼行數:12,代碼來源:Report.java

示例15: checkDescribed

import java.util.Set; //導入方法依賴的package包/類
public void checkDescribed(String description, XMLFile xmlFile,
	Set<String> declared, Set<String> described) throws DocumentException {

	Set<String> notDescribed = new HashSet<String>();
	notDescribed.addAll(declared);
	notDescribed.removeAll(described);

	if (!notDescribed.isEmpty())
		throw new CheckMessagesException(description + ": " + notDescribed.toString(), xmlFile);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:11,代碼來源:CheckMessages.java


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