java.util.LinkedHashSet.toArray()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(9.4k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中java.util.LinkedHashSet.toArray()方法的一些代码示例,展示了LinkedHashSet.toArray()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedHashSet.toArray()方法的具体详情如下:
包路径:java.util.LinkedHashSet
类名称:LinkedHashSet
方法名:toArray

LinkedHashSet.toArray介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate-orm

public AggregatedClassLoader(final LinkedHashSet<ClassLoader> orderedClassLoaderSet, TcclLookupPrecedence precedence) {
  super( null );
  individualClassLoaders = orderedClassLoaderSet.toArray( new ClassLoader[orderedClassLoaderSet.size()] );
  tcclLookupPrecedence = precedence;
}

代码示例来源:origin: redisson/redisson

/**
 * Returns the lineage of the specified class ordered by specificity (the class itself is at position 0 since it is most specific in its lineage).
 */
public static Class<?>[] getLineage(final Class<?> clazz) {
 final LineageInfo lineageInfo = getLineageInfo(clazz);
 return lineageInfo == null ? EMPTY_CLASS_ARRAY : lineageInfo.lineage.toArray(new Class<?>[lineageInfo.lineage.size()]);
}

代码示例来源:origin: requery/requery

static <E> Attribute<E, ?>[] toArray(Collection<Attribute<E, ?>> attributes,
                   Predicate<Attribute<E, ?>> filter) {
  LinkedHashSet<Attribute> filtered = new LinkedHashSet<>();
  for (Attribute<E, ?> attribute : attributes) {
    if (filter == null || filter.test(attribute)) {
      filtered.add(attribute);
    }
  }
  Attribute<E, ?>[] array = new Attribute[filtered.size()];
  return filtered.toArray(array);
}

代码示例来源:origin: wildfly/wildfly

@Override
  public String[] getMechanismNames(final Map<String, ?> props) {
    final LinkedHashSet<String> names = new LinkedHashSet<String>();
    for (SaslServerFactory factory : factories) {
      if (factory != null) {
        Collections.addAll(names, factory.getMechanismNames(props));
      }
    }
    return names.toArray(new String[names.size()]);
  }
}

代码示例来源:origin: wildfly/wildfly

public String[] getMechanismNames(final Map<String, ?> props) {
    final LinkedHashSet<String> names = new LinkedHashSet<String>();
    for (SaslClientFactory factory : factories) {
      Collections.addAll(names, factory.getMechanismNames(props));
    }
    return names.toArray(new String[names.size()]);
  }
}

代码示例来源:origin: robovm/robovm

public static Locale[] localesFromStrings(String[] localeNames) {
 // We need to remove duplicates caused by the conversion of "he" to "iw", et cetera.
 // Java needs the obsolete code, ICU needs the modern code, but we let ICU know about
 // both so that we never need to convert back when talking to it.
 LinkedHashSet<Locale> set = new LinkedHashSet<Locale>();
 for (String localeName : localeNames) {
  set.add(localeFromString(localeName));
 }
 return set.toArray(new Locale[set.size()]);
}

代码示例来源:origin: RuedigerMoeller/fast-serialization

/**
 * Returns the lineage of the specified class ordered by specificity (the class itself is at position 0 since it is most specific in its lineage).
 */
public static Class<?>[] getLineage(final Class<?> clazz) {
 final LineageInfo lineageInfo = getLineageInfo(clazz);
 return lineageInfo == null ? EMPTY_CLASS_ARRAY : lineageInfo.lineage.toArray(new Class<?>[lineageInfo.lineage.size()]);
}

代码示例来源:origin: nutzam/nutz

public String[] getNames() {
  LinkedHashSet<String> list = new LinkedHashSet<String>();
  list.addAll(Arrays.asList(loader.getName()));
  if (context != null)
    list.addAll(context.names());
  return list.toArray(new String[list.size()]);
}

代码示例来源:origin: wildfly/wildfly

/**
 * @see org.wildfly.security.http.HttpServerAuthenticationMechanismFactory#getMechanismNames(java.util.Map)
 */
@Override
public String[] getMechanismNames(Map<String, ?> properties) {
  LinkedHashSet<String> names = new LinkedHashSet<>();
  for (HttpServerAuthenticationMechanismFactory current : factories) {
    if (current != null) {
      Collections.addAll(names, current.getMechanismNames(properties));
    }
  }
  if (log.isTraceEnabled()) {
    log.tracef("No %s provided by factories in %s: %s", HttpServerAuthenticationMechanismFactory.class.getSimpleName(), getClass().getSimpleName(), Arrays.toString(factories));
  }
  return names.toArray(new String[names.size()]);
}

代码示例来源:origin: redisson/redisson

final Class<?>[] array = ancestors.toArray(new Class<?>[ancestors.size()]);
Arrays.sort(array, SPECIFICITY_CLASS_COMPARATOR);
final LinkedHashSet<Class<?>> lineage = new LinkedHashSet<Class<?>>(array.length + 1);

代码示例来源:origin: geoserver/geoserver

if (normalized.size() == 0) {
  value = null;
} else if (normalized.size() == 1) {
  value = normalized.iterator().next();
} else {
  value = (String[]) normalized.toArray(new String[normalized.size()]);

代码示例来源:origin: wildfly/wildfly

/**
 * Evaluate this selector against the given list of JSSE supported mechanisms.
 *
 * @param supportedMechanisms the supported mechanisms
 * @return the enabled mechanisms (not {@code null})
 */
public final String[] evaluate(String[] supportedMechanisms) {
  if (ElytronMessages.tls.isTraceEnabled()) {
    StringBuilder b = new StringBuilder(supportedMechanisms.length * 16);
    b.append("Evaluating filter \"").append(this).append("\" on supported mechanisms:");
    for (String s : supportedMechanisms) {
      b.append("\n    ").append(s);
    }
    ElytronMessages.tls.trace(b);
  }
  final MechanismDatabase database = MechanismDatabase.getInstance();
  final LinkedHashMap<MechanismDatabase.Entry, String> supportedMap = new LinkedHashMap<>(supportedMechanisms.length);
  for (String supportedMechanism : supportedMechanisms) {
    final MechanismDatabase.Entry entry = database.getCipherSuite(supportedMechanism);
    if (entry != null) {
      ElytronMessages.tls.tracef("Found supported mechanism %s", supportedMechanism);
      supportedMap.put(entry, supportedMechanism);
    } else {
      ElytronMessages.tls.tracef("Dropping unknown mechanism %s", supportedMechanism);
    }
  }
  final LinkedHashSet<String> enabledSet = new LinkedHashSet<String>(supportedMap.size());
  doEvaluate(enabledSet, supportedMap);
  return enabledSet.toArray(new String[enabledSet.size()]);
}

代码示例来源:origin: nutzam/nutz

public String[] getNamesByAnnotation(Class<? extends Annotation> klass, IocContext context) {
  List<String> names = new ArrayList<String>(loader.getNamesByAnnotation(createLoading(), klass));
  IocContext cntx;
  if (null == context || context == this.context)
    cntx = this.context;
  else
    cntx = new ComboContext(context, this.context);
  for (String name : cntx.names()) {
    ObjectProxy op = cntx.fetch(name);
    if (op.getObj() != null && klass.getAnnotation(klass) != null)
      names.add(name);
  }
  LinkedHashSet<String> re = new LinkedHashSet<String>();
  for (String name : names) {
    if (Strings.isBlank(name) || "null".equals(name))
      continue;
    re.add(name);
  }
  return re.toArray(new String[re.size()]);
}

代码示例来源:origin: nutzam/nutz

public String[] getNamesByType(Class<?> klass, IocContext context) {
  List<String> names = new ArrayList<String>(loader.getNamesByTypes(createLoading(), klass));
  IocContext cntx;
  if (null == context || context == this.context)
    cntx = this.context;
  else
    cntx = new ComboContext(context, this.context);
  for (String name : cntx.names()) {
    ObjectProxy op = cntx.fetch(name);
    if (op.getObj() != null && klass.isAssignableFrom(op.getObj().getClass()))
      names.add(name);
  }
  LinkedHashSet<String> re = new LinkedHashSet<String>();
  for (String name : names) {
    if (Strings.isBlank(name) || "null".equals(name))
      continue;
    re.add(name);
  }
  return re.toArray(new String[re.size()]);
}

代码示例来源:origin: RuedigerMoeller/fast-serialization

final Class<?>[] array = ancestors.toArray(new Class<?>[ancestors.size()]);
Arrays.sort(array, SPECIFICITY_CLASS_COMPARATOR);
final LinkedHashSet<Class<?>> lineage = new LinkedHashSet<Class<?>>(array.length + 1);

代码示例来源:origin: protostuff/protostuff

static PojoWithArrayAndSet filledPojoWithArrayAndSet()
{
  LinkedHashSet<Status> someEnumAsSet = new LinkedHashSet<Status>();
  someEnumAsSet.add(Status.PENDING);
  someEnumAsSet.add(Status.STARTED);
  someEnumAsSet.add(Status.COMPLETED);
  LinkedHashSet<Bar> someBarAsSet = new LinkedHashSet<Bar>();
  someBarAsSet.add(bar);
  someBarAsSet.add(negativeBar);
  LinkedHashSet<Float> someFloatAsSet = new LinkedHashSet<Float>();
  someFloatAsSet.add(123.321f);
  someFloatAsSet.add(-456.654f);
  return new PojoWithArrayAndSet(someEnumAsSet,
      someEnumAsSet.toArray(new Status[someEnumAsSet.size()]),
      someBarAsSet,
      someBarAsSet.toArray(new Bar[someBarAsSet.size()]),
      someFloatAsSet, someFloatAsSet.toArray(new Float[someFloatAsSet
          .size()]), new Double[] { 112233.332211d,
          445566.665544d }, new double[] { -112233.332211d,
          -445566.665544d });
}

代码示例来源:origin: prestodb/presto

context.addBeanSerializerModifier(_serializerModifier);
if (_subtypes != null && _subtypes.size() > 0) {
  context.registerSubtypes(_subtypes.toArray(new NamedType[_subtypes.size()]));

代码示例来源:origin: redisson/redisson

context.addBeanSerializerModifier(_serializerModifier);
if (_subtypes != null && _subtypes.size() > 0) {
  context.registerSubtypes(_subtypes.toArray(new NamedType[_subtypes.size()]));

代码示例来源:origin: bytedeco/javacpp

for (String libraryName : map.keySet()) {
  LinkedHashSet<Class> classSet = map.get(libraryName);
  Class[] classArray = classSet.toArray(new Class[classSet.size()]);
  File[] files = generateAndCompile(classArray, libraryName, count == 0, count == map.size() - 1);
  if (files != null && files.length > 0) {

代码示例来源:origin: pentaho/pentaho-kettle

extensionNames.add( BaseMessages.getString( PKG, "Spoon.Dialog.OpenFile.AllFiles" ) );
String[] exts = new String[extensions.size() + 1];
exts[0] = allExtensions.toString();
System.arraycopy( extensions.toArray( new String[extensions.size()] ), 0, exts, 1, extensions.size() );
String[] extNames = new String[extensionNames.size() + 1];
extNames[0] = BaseMessages.getString( PKG, "Spoon.Dialog.OpenFile.AllTypes" );
System.arraycopy( extensionNames.toArray( new String[extensionNames.size()] ), 0, extNames, 1, extensionNames
  .size() );

相关文章