下面列出了java.util.List#values ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
for (List<Include> includes : includes.values()) {
// Get filename from first include
String source = includes.get(0).getSourceFile().getName();
builder.append("Includes for '" + source + "':\n");
builder.append(includes.stream()
.map(Include::toString)
.collect(Collectors.joining(", ")));
builder.append("\n");
}
return builder.toString();
}
/**
* Get all registration points associated with this registration.
*
* @return all registration points. Will not be {@code null} but may be empty
*/
public synchronized Set<RegistrationPoint> getRegistrationPoints() {
Set<RegistrationPoint> result = new HashSet<>();
for (List<RegistrationPoint> registrationPoints : registrationPoints.values()) {
result.addAll(registrationPoints);
}
return Collections.unmodifiableSet(result);
}
/**
* Chooses the first non-null client alias returned from the delegate {@link X509TrustManagers},
* or {@code null} if there are no matches.
*/
@Override
public @Nullable String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket){
for (List<X509KeyManager> keyManagers : keyManagers.values()) {
for (X509KeyManager x509KeyManager : keyManagers) {
String alias = x509KeyManager.chooseClientAlias(keyType, issuers, socket);
if (alias != null) {
return alias;
}
}
}
return null;
}
/**
* Chooses the first non-null server alias returned from the delegate {@link X509TrustManagers},
* or {@code null} if there are no matches.
*/
@Override
public @Nullable String chooseServerAlias(String keyType, Principal[] issuers, Socket socket){
for (List<X509KeyManager> keyManagers : keyManagers.values()) {
for (X509KeyManager x509KeyManager : keyManagers) {
String alias = x509KeyManager.chooseServerAlias(keyType, issuers, socket);
if (alias != null) {
return alias;
}
}
}
return null;
}
/**
* Returns the first non-null private key associated with the given alias, or {@code null} if
* the alias can't be found.
*/
@Override
public @Nullable PrivateKey getPrivateKey(String alias){
for (List<X509KeyManager> keyManagers : keyManagers.values()) {
for (X509KeyManager x509KeyManager : keyManagers) {
PrivateKey privateKey = x509KeyManager.getPrivateKey(alias);
if (privateKey != null) {
return privateKey;
}
}
}
return null;
}
/**
* Returns the first non-null certificate chain associated with the given alias, or {@code null}
* if the alias can't be found.
*/
@Override
public @Nullable X509Certificate[] getCertificateChain(String alias){
for (List<X509KeyManager> keyManagers : keyManagers.values()) {
for (X509KeyManager x509KeyManager : keyManagers) {
X509Certificate[] chain = x509KeyManager.getCertificateChain(alias);
if (chain != null && chain.length > 0) {
return chain;
}
}
}
return null;
}
/**
* Get all matching aliases for authenticating the client side of a secure socket, or
* {@code null} if there are no matches.
*/
@Override
public @Nullable String[] getClientAliases(String keyType, Principal[] issuers){
List<String> ret = new ArrayList<>();
for (List<X509KeyManager> keyManagers : keyManagers.values()) {
for (X509KeyManager x509KeyManager : keyManagers) {
ret.addAll(Arrays.asList(x509KeyManager.getClientAliases(keyType, issuers)));
}
}
return ret.toArray(new String[ret.size()]);
}
/**
* Get all matching aliases for authenticating the server side of a secure socket, or
* {@code null} if there are no matches.
*/
@Override
public @Nullable String[] getServerAliases(String keyType, Principal[] issuers){
List<String> ret = new ArrayList<>();
for (List<X509KeyManager> keyManagers : keyManagers.values()) {
for (X509KeyManager x509KeyManager : keyManagers) {
ret.addAll(Arrays.asList(x509KeyManager.getServerAliases(keyType, issuers)));
}
}
return ret.toArray(new String[ret.size()]);
}