当前位置: 首页>>代码示例>>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;未经允许,请勿转载。