本文整理了Java中java.util.EnumSet.stream()
方法的一些代码示例,展示了EnumSet.stream()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EnumSet.stream()
方法的具体详情如下:
包路径:java.util.EnumSet
类名称:EnumSet
方法名:stream
暂无
代码示例来源:origin: spring-projects/spring-framework
private static Set<HttpMethod> initAllowedHttpMethods(Set<HttpMethod> declaredMethods) {
if (declaredMethods.isEmpty()) {
return EnumSet.allOf(HttpMethod.class).stream()
.filter(method -> method != HttpMethod.TRACE)
.collect(Collectors.toSet());
}
else {
Set<HttpMethod> result = new LinkedHashSet<>(declaredMethods);
if (result.contains(HttpMethod.GET)) {
result.add(HttpMethod.HEAD);
}
result.add(HttpMethod.OPTIONS);
return result;
}
}
代码示例来源:origin: apache/incubator-druid
private static List<String> getNames()
{
return EnumSet.allOf(KinesisRegion.class).stream().map(KinesisRegion::serialize).collect(Collectors.toList());
}
代码示例来源:origin: org.junit.jupiter/junit-jupiter-params
@Override
public Stream<? extends Arguments> provideArguments(ExtensionContext context) {
return constants.stream().map(Arguments::of);
}
代码示例来源:origin: apache/hbase
/**
* Convert an enum set of ClusterMetrics.Option to a list of ClusterStatusProtos.Option
* @param options the ClusterMetrics options
* @return a list of ClusterStatusProtos.Option
*/
public static List<ClusterStatusProtos.Option> toOptions(EnumSet<ClusterMetrics.Option> options) {
return options.stream().map(ClusterMetricsBuilder::toOption).collect(Collectors.toList());
}
代码示例来源:origin: speedment/speedment
private EnumSet<E> evaluate(Predicate<E> predicate) {
final EnumSet<E> result = EnumSet.noneOf(enumClass);
constants.stream().filter(predicate).forEach(result::add);
return result;
}
}
代码示例来源:origin: speedment/speedment
private EnumSet<E> evaluate(Predicate<E> predicate) {
final EnumSet<E> result = EnumSet.noneOf(enumClass);
constants.stream().filter(predicate).forEach(result::add);
return result;
}
代码示例来源:origin: apache/incubator-druid
@JsonCreator
public static KinesisRegion fromString(String value)
{
return EnumSet.allOf(KinesisRegion.class)
.stream()
.filter(x -> x.serialize().equals(value))
.findFirst()
.orElseThrow(() -> new IAE("Invalid region %s, region must be one of: %s", value, getNames()));
}
代码示例来源:origin: pmd/pmd
/**
* Builds a new code area with the given enum type as layer id provider.
* Constants of the enum will identify layers of the code area.
*
* @param idEnum Enum type
*/
// the annotation lets the value be passed from FXML
public HighlightLayerCodeArea(@NamedArg("idEnum") Class<K> idEnum) {
super();
this.layersById = EnumSet.allOf(idEnum)
.stream()
.collect(Collectors.toConcurrentMap(id -> id, id -> new StyleLayer()));
}
代码示例来源:origin: wildfly/wildfly
private static void writeAuthToken(XMLExtendedStreamWriter writer, Property token) throws XMLStreamException {
writer.writeStartElement(XMLElement.forAuthTokenName(token.getName()).getLocalName());
if (PlainAuthTokenResourceDefinition.PATH.getValue().equals(token.getName())) {
writeAttributes(writer, token.getValue(), AuthTokenResourceDefinition.Attribute.class);
}
if (DigestAuthTokenResourceDefinition.PATH.getValue().equals(token.getName())) {
writeAttributes(writer, token.getValue(), Stream.concat(EnumSet.allOf(AuthTokenResourceDefinition.Attribute.class).stream(), EnumSet.allOf(DigestAuthTokenResourceDefinition.Attribute.class).stream()));
}
if (CipherAuthTokenResourceDefinition.PATH.getValue().equals(token.getName())) {
writeAttributes(writer, token.getValue(), Stream.concat(EnumSet.allOf(AuthTokenResourceDefinition.Attribute.class).stream(), EnumSet.allOf(CipherAuthTokenResourceDefinition.Attribute.class).stream()));
}
writer.writeEndElement();
}
代码示例来源:origin: ehcache/ehcache3
.withEventOrderingMode(EventOrderingType.fromValue(serviceConfig.orderingMode().name()))
.withEventsToFireOn(serviceConfig.fireOn()
.stream()
.map(eventType -> EventType.fromValue(eventType.name()))
.collect(toSet()));
代码示例来源:origin: org.apache.hbase/hbase-client
/**
* Convert an enum set of ClusterMetrics.Option to a list of ClusterStatusProtos.Option
* @param options the ClusterMetrics options
* @return a list of ClusterStatusProtos.Option
*/
public static List<ClusterStatusProtos.Option> toOptions(EnumSet<ClusterMetrics.Option> options) {
return options.stream().map(ClusterMetricsBuilder::toOption).collect(Collectors.toList());
}
代码示例来源:origin: google/bundletool
private static <E extends Enum<E>> ImmutableSortedMap<String, E> enumValuesByName(
Class<E> enumType, ImmutableSet<E> ignoreValues) {
return EnumSet.allOf(enumType)
.stream()
.filter(not(ignoreValues::contains))
.sorted()
.collect(toImmutableSortedMap(Ordering.natural(), Enum::name, identity()));
}
代码示例来源:origin: magefree/mage
public String getTypeText() {
StringBuilder type = new StringBuilder();
if (!getSuperTypes().isEmpty()) {
type.append(String.join(" ", getSuperTypes().stream().map(SuperType::toString).collect(Collectors.toList())));
type.append(" ");
}
if (!getCardTypes().isEmpty()) {
type.append(String.join(" ", getCardTypes().stream().map(CardType::toString).collect(Collectors.toList())));
type.append(" ");
}
if (!getSubTypes().isEmpty()) {
type.append(" - ");
type.append(String.join(" ", getSubTypes().stream().map(SubType::toString).collect(Collectors.toList())));
}
return type.toString();
}
代码示例来源:origin: apache/accumulo
Property.MONITOR_SSL_TRUSTSTOREPASS);
if (requireForSecure.stream().map(p -> conf.get(p)).anyMatch(s -> s == null || s.isEmpty())) {
LOG.debug("Not configuring Jetty to use TLS");
return new AbstractConnectionFactory[] {httpFactory};
代码示例来源:origin: ahmetaa/zemberek-nlp
private static LexiconProto.DictionaryItem convertToProto(DictionaryItem item) {
LexiconProto.DictionaryItem.Builder builder = LexiconProto.DictionaryItem.newBuilder()
.setLemma(item.lemma)
.setIndex(item.index)
.setPrimaryPos(primaryPosConverter
.convertTo(item.primaryPos, LexiconProto.PrimaryPos.PrimaryPos_Unknown));
String lowercaseLemma = item.lemma.toLowerCase();
if (item.root != null && !item.root.equals(lowercaseLemma)) {
builder.setRoot(item.root);
}
if (item.pronunciation != null && !item.pronunciation.equals(lowercaseLemma)) {
builder.setPronunciation(item.pronunciation);
}
if (item.secondaryPos != null && item.secondaryPos != SecondaryPos.None) {
builder.setSecondaryPos(secondaryPosConverter.convertTo(
item.secondaryPos, LexiconProto.SecondaryPos.SecondaryPos_Unknown));
}
if (item.attributes != null && !item.attributes.isEmpty()) {
builder.addAllRootAttributes(item.attributes
.stream()
.map((attribute) ->
rootAttributeConverter
.convertTo(attribute, LexiconProto.RootAttribute.RootAttribute_Unknown))
.collect(Collectors.toList()));
}
if (item.getReferenceItem() != null) {
builder.setReference(item.getReferenceItem().id);
}
return builder.build();
}
代码示例来源:origin: net.sourceforge.owlapi/owlapi-distribution
/**
* @param i the string to check
* @return true if the string is for a namespace ignored by default
*/
public static boolean isDefaultIgnoredImport(String i) {
return defaultIgnoredImports.stream().anyMatch(n -> n.hashless.equals(i));
}
代码示例来源:origin: apache/james-project
/**
* Returns a serialized form of this {@link MailboxACL.Right} as
* {@link String}.
*
* @return a {@link String}
*/
public String serialize() {
return value.stream()
.map(Right::asCharacter)
.map(String::valueOf)
.collect(Collectors.joining());
}
代码示例来源:origin: exercism/java
List<Allergen> getList() {
return EnumSet.allOf(Allergen.class).stream()
.filter(this::isAllergicTo)
.collect(Collectors.toList());
}
代码示例来源:origin: conveyal/r5
@Override
public void serialize(EnumSet<TransitModes> modes, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
String str = modes.stream().map(TransitModes::toString).collect(Collectors.joining(","));
jsonGenerator.writeString(str);
}
}
代码示例来源:origin: de.unijena.bioinf.ms/fingerid_utils_oss
public static String bitsToNames(long bits) {
return bitsToTypes(bits).stream()
.map(PredictorType::name)
.collect(Collectors.joining(","));
}
内容来源于网络,如有侵权,请联系作者删除!