本文整理汇总了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);
}
示例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.
}
示例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));
}
示例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.");
}
}
示例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() + "]");
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例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());
}
}
示例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)));
}
示例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());
}
}
}
示例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();
}
示例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);
}
示例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);
}