本文整理了Java中java.util.HashSet.toArray()
方法的一些代码示例,展示了HashSet.toArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HashSet.toArray()
方法的具体详情如下:
包路径:java.util.HashSet
类名称:HashSet
方法名:toArray
暂无
代码示例来源:origin: airbnb/lottie-android
public ArrayList<String> getWarnings() {
return new ArrayList<>(Arrays.asList(warnings.toArray(new String[warnings.size()])));
}
代码示例来源:origin: com.h2database/h2
private static String[] disableSSL(String[] enabled) {
HashSet<String> set = new HashSet<>();
for (String x : enabled) {
if (!x.startsWith("SSL")) {
set.add(x);
}
}
return set.toArray(new String[0]);
}
代码示例来源:origin: neo4j/neo4j
private IndexLimitation[] limitationsUnion( Iterable<IndexCapability> capabilities )
{
HashSet<IndexLimitation> union = new HashSet<>();
for ( IndexCapability capability : capabilities )
{
union.addAll( Arrays.asList( capability.limitations() ) );
}
return union.toArray( new IndexLimitation[union.size()] );
}
}
代码示例来源:origin: quartz-scheduler/quartz
public String[] getPropertyGroups(String prefix) {
Enumeration<?> keys = props.propertyNames();
HashSet<String> groups = new HashSet<String>(10);
if (!prefix.endsWith(".")) {
prefix += ".";
}
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
if (key.startsWith(prefix)) {
String groupName = key.substring(prefix.length(), key.indexOf(
'.', prefix.length()));
groups.add(groupName);
}
}
return (String[]) groups.toArray(new String[groups.size()]);
}
代码示例来源:origin: apache/ignite
if (!rspNodes.add(id))
return; // ignore duplicated messages
if (rspNodes.size() == nodeCount)
fut.onDone(new UpdateResult(updCntr, errorKeys == null ? null : errorKeys.toArray()));
代码示例来源:origin: cloudfoundry/uaa
HashSet<String> envProfiles = new HashSet<>(Arrays.asList(activeProfiles));
envProfiles.addAll(Arrays.asList(StringUtils.commaDelimitedListToStringArray(profiles)));
envProfiles.add("strict");
context.getEnvironment().setActiveProfiles(envProfiles.toArray(new String[0]));
} else {
context.getEnvironment().setActiveProfiles(StringUtils.commaDelimitedListToStringArray(profiles));
代码示例来源:origin: quartz-scheduler/quartz
public String[] getPropertyGroups(String prefix) {
Enumeration<?> keys = props.propertyNames();
HashSet<String> groups = new HashSet<String>(10);
if (!prefix.endsWith(".")) {
prefix += ".";
}
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
if (key.startsWith(prefix)) {
String groupName = key.substring(prefix.length(), key.indexOf(
'.', prefix.length()));
groups.add(groupName);
}
}
return (String[]) groups.toArray(new String[groups.size()]);
}
代码示例来源:origin: geotools/geotools
attr.add(ah.compress(parent));
} else {
AttributeGroupHandler agh = (AttributeGroupHandler) o;
attr.add(ah.compress(parent));
} else {
AttributeGroupHandler agh = (AttributeGroupHandler) o;
attr.add(it[i]);
dct.attributes = (Attribute[]) attr.toArray(new Attribute[attr.size()]);
dct.namespace = parent.getTargetNamespace();
dct.block = block;
代码示例来源:origin: oblac/jodd
/**
* Returns all the profiles that define certain prop's key name.
* Key name is given as a wildcard, or it can be matched fully.
*/
public String[] getProfilesFor(final String propKeyNameWildcard) {
HashSet<String> profiles = new HashSet<>();
profile:
for (Map.Entry<String, Map<String, PropsEntry>> entries : data.profileProperties.entrySet()) {
String profileName = entries.getKey();
Map<String, PropsEntry> value = entries.getValue();
for (String propKeyName : value.keySet()) {
if (Wildcard.equalsOrMatch(propKeyName, propKeyNameWildcard)) {
profiles.add(profileName);
continue profile;
}
}
}
return profiles.toArray(new String[0]);
}
代码示例来源:origin: wildfly/wildfly
/**
* Get the list of excluded http methods
*
* @return excluded http methods if the exist, null if there were no excluded security constraints
*/
public String[] getExcludedMethods() {
String[] httpMethods = null;
if (excludedMethods != null) {
httpMethods = new String[excludedMethods.size()];
excludedMethods.toArray(httpMethods);
}
return httpMethods;
}
代码示例来源:origin: h2oai/h2o-2
HashSet<Key> keySet = new HashSet<Key>(t._conflicts);
keySet.addAll(t._failedSetup);
Key [] keys2 = new Key[keySet.size()];
t2.invoke(keySet.toArray(keys2));
t._failedSetup = t2._failedSetup;
t._conflicts = t2._conflicts;
代码示例来源:origin: apache/activemq
public static ActiveMQDestination[] getDurableTopicDestinations(final Set<ActiveMQDestination> durableDestinations) {
if (durableDestinations != null) {
HashSet<ActiveMQDestination> topics = new HashSet<ActiveMQDestination>();
for (ActiveMQDestination d : durableDestinations) {
if( d.isTopic() ) {
topics.add(d);
}
}
ActiveMQDestination[] dest = new ActiveMQDestination[topics.size()];
dest = topics.toArray(dest);
return dest;
}
return null;
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
/**
* Creates an array of tables where all occurences of tables in the provided list of tables and columns are included
*/
public static Table[] getTables(Collection<Table> tableList, Iterable<Column> columnList) {
HashSet<Table> set = new HashSet<Table>();
set.addAll(tableList);
for (Column column : columnList) {
set.add(column.getTable());
}
return set.toArray(new Table[set.size()]);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public static File[] getJarsWithNatives() {
HashSet<File> jarFiles = new HashSet<File>();
for (Map.Entry<NativeLibrary.Key, NativeLibrary> lib : nativeLibraryMap.entrySet()) {
File jarFile = getJarForNativeLibrary(lib.getValue().getPlatform(), lib.getValue().getName());
if (jarFile != null) {
jarFiles.add(jarFile);
}
}
return jarFiles.toArray(new File[0]);
}
代码示例来源:origin: hibernate/hibernate-orm
public String[] collectQuerySpaces() {
final HashSet<String> spaces = new HashSet<String>();
collectQuerySpaces( spaces );
return spaces.toArray( new String[ spaces.size() ] );
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/** resolves (and deduplicates) host specification */
private InetAddress[] resolveInetAddresses(String hosts[]) throws IOException {
if (hosts.length == 0) {
throw new IllegalArgumentException("empty host specification");
}
// deduplicate, in case of resolver misconfiguration
// stuff like https://bugzilla.redhat.com/show_bug.cgi?id=496300
HashSet<InetAddress> set = new HashSet<>();
for (String host : hosts) {
set.addAll(Arrays.asList(resolveInternal(host)));
}
return set.toArray(new InetAddress[set.size()]);
}
代码示例来源:origin: alibaba/mdrill
public static Integer[] storm_task_ids(StormClusterState stat,
String storm_id) {
HashSet<Integer> rtn = new HashSet<Integer>();
Assignment ass = stat.assignment_info(storm_id, null);
if (ass != null) {
for (Integer task : ass.getTaskToNodeport().keySet()) {
rtn.add(task);
}
}
Integer[] rtnarr = new Integer[rtn.size()];
return rtn.toArray(rtnarr);
}
代码示例来源:origin: apache/metamodel
/**
* Creates an array of tables where all occurences of tables in the provided list of tables and columns are included
*/
public static Table[] getTables(Collection<Table> tableList, Iterable<Column> columnList) {
HashSet<Table> set = new HashSet<Table>();
set.addAll(tableList);
for (Column column : columnList) {
set.add(column.getTable());
}
return set.toArray(new Table[set.size()]);
}
代码示例来源:origin: hsz/idea-gitignore
/**
* Stores information about dismissed notification about editing ignored file.
*
* @param project current project
* @param file current file
*/
public static void setDismissedIgnoredEditingNotification(@NotNull Project project, @NotNull VirtualFile file) {
final PropertiesComponent props = properties(project);
String[] values = props.getValues(DISMISSED_IGNORED_EDITING_NOTIFICATION);
final HashSet<String> set = ContainerUtil.newHashSet(values != null ? values : new String[0]);
set.add(file.getCanonicalPath());
props.setValues(DISMISSED_IGNORED_EDITING_NOTIFICATION, set.toArray(new String[0]));
}
代码示例来源:origin: alibaba/jetcache
public static Class<?>[] getAllInterfaces(Object obj) {
Class<?> c = obj.getClass();
HashSet<Class<?>> s = new HashSet<>();
do {
Class<?>[] its = c.getInterfaces();
Collections.addAll(s, its);
c = c.getSuperclass();
} while (c != null);
return s.toArray(new Class<?>[s.size()]);
}
内容来源于网络,如有侵权,请联系作者删除!