当前位置: 首页>>代码示例>>Java>>正文


Java LinkedHashSet.toArray方法代码示例

本文整理汇总了Java中java.util.LinkedHashSet.toArray方法的典型用法代码示例。如果您正苦于以下问题:Java LinkedHashSet.toArray方法的具体用法?Java LinkedHashSet.toArray怎么用?Java LinkedHashSet.toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.LinkedHashSet的用法示例。


在下文中一共展示了LinkedHashSet.toArray方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addOrderIsRespected

import java.util.LinkedHashSet; //导入方法依赖的package包/类
@Theory
public void addOrderIsRespected(Path p1, Path p2, Path p3) {
    String[] actual = new ClassPath()
                     .add(p1, p2, p3)
                     .toStream()
                     .map(Path::toString)
                     .toArray(String[]::new);
    
    LinkedHashSet<String> ps = new LinkedHashSet<>();  // respects add order
    ps.add(p1.toString());
    ps.add(p2.toString());
    ps.add(p3.toString());
    ps.remove("");
    String[] expected = ps.toArray(new String[0]);
    
    assertArrayEquals(expected, actual);
}
 
开发者ID:openmicroscopy,项目名称:omero-ms-queue,代码行数:18,代码来源:ClassPathTest.java

示例2: addMapping

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * Add a new charset name mapping
 * @param javaName the (supposedly) java name of the charset.
 * @param xmlNames a list of corresponding XML names for that charset.
 */
void addMapping(String javaName, Collection<String> xmlNames) {
    final LinkedHashSet<String> aliasNames = new LinkedHashSet<>();
    aliasNames.add(javaName);
    aliasNames.addAll(xmlNames);
    final String[] aliases = aliasNames.toArray(new String[aliasNames.size()]);
    final String cs = findCharsetNameFor(aliases);
    if (cs != null) {
        registerCharsetNameFor(cs, aliases);
        if (xmlNames.size() > 0) {
            String preferred = xmlNames.iterator().next();
            String cachedPreferred = preferredMime.get(cs.toUpperCase());
            if (cachedPreferred != null && !cachedPreferred.equals(preferred)) {
                throw new ConflictingPreferredMimeNameError(cs, cachedPreferred, preferred);
            }
            preferredMime.put(cs.toUpperCase(), preferred);
        }
    } else {
        registerUnresolvedNamesFor(aliases, aliasNames);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:26,代码来源:CheckEncodingPropertiesFile.java

示例3: create

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * 
 */
public static Condition create(String[] nameList) throws ConditionException {
    if (nameList == null) {
        throw new ConditionException("name list may not be null");
    }
    
    if (nameList.length == 0) {
        throw new ConditionException("name list may not be empty");
    }
    
    if (nameList.length == 1) {
        return new Condition(new String[]{normalize(checkName(nameList[0]))});
    }
    
    LinkedHashSet<String> nameSet = new LinkedHashSet<>();
    
    for (int i=0;i<nameList.length;i++) {
        nameSet.add(normalize(checkName(nameList[i])));
    }
    
    return new Condition(nameSet.toArray(SystemToolkit.EMPTY_STRING_ARRAY));
}
 
开发者ID:annoflex,项目名称:annoflex,代码行数:25,代码来源:Condition.java

示例4: extractParamsFromCondition

import java.util.LinkedHashSet; //导入方法依赖的package包/类
public static String[] extractParamsFromCondition(String condition, boolean includeColon) {
    LinkedHashSet<String> matches = new LinkedHashSet<>();
    String pattern = "(?<![:\\[])(:[^\\W\\d]\\w+)";
    Pattern r = Pattern.compile(pattern);
    Matcher m = r.matcher(condition);
    while (m.find()) {
        String param = m.group(1);
        if (! includeColon)
            param = param.replace(":", "");
        matches.add(param);
    }
    return matches.toArray(new String[0]);
}
 
开发者ID:nvlad,项目名称:yii2support,代码行数:14,代码来源:DatabaseUtils.java

示例5: createDeadlockDescriptions

import java.util.LinkedHashSet; //导入方法依赖的package包/类
private Deadlock[] createDeadlockDescriptions(Set<LinkedHashSet<ThreadInfo>> cycles) {
    Deadlock result[] = new Deadlock[cycles.size()];
    int count = 0;
    for (LinkedHashSet<ThreadInfo> cycle : cycles) {
        ThreadInfo asArray[] = cycle.toArray(new ThreadInfo[cycle.size()]);
        Deadlock d = new Deadlock(asArray);
        result[count++] = d;
    }
    return result;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:DeadlockAnalyzer.java

示例6: setNodeString

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
     * @param nodes
     *            the nodes to set
     */
//    public void setNodes(String[] nodes)
//    {
//        LinkedHashSet<String> unique = new LinkedHashSet<String>();
//        for(String node : nodes)
//        {
//            for(String split : node.split(","))
//            {
//                unique.add(split.trim());
//            }
//        }
//        
//        this.nodes = unique.toArray(new String[0]);
//    }
    
    public void setNodeString(String nodes)
    {
        LinkedHashSet<String> unique = new LinkedHashSet<String>();

        for(String split : nodes.split(","))
        {
            unique.add(split.trim());
        }


        this.nodes = unique.toArray(new String[0]);
    }
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:SolrStoreMapping.java

示例7: getLocations

import java.util.LinkedHashSet; //导入方法依赖的package包/类
private String[] getLocations() {
	String property = super.getPropertyAsString(ARGUMENT_LOCATIONS).trim();
	List<String> locations = Splitter.on(',').trimResults().omitEmptyStrings().splitToList(property);
	LinkedHashSet<String> locationSet = new LinkedHashSet<>(locations);
	checkState(!locationSet.isEmpty(), "no Spring configuration locations provided");
	return locationSet.toArray(new String[locationSet.size()]);
}
 
开发者ID:qas-guru,项目名称:martini-jmeter-extension,代码行数:8,代码来源:SpringPreProcessor.java

示例8: BulkOperationCleanupAction

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * Constructs an action to cleanup "affected cache regions" based on the
 * affected entity persisters.  The affected regions are defined as the
 * region (if any) of the entity persisters themselves, plus the
 * collection regions for any collection in which those entity
 * persisters participate as elements/keys/etc.
 *
 * @param session The session to which this request is tied.
 * @param affectedQueryables The affected entity persisters.
 */
public BulkOperationCleanupAction(SessionImplementor session, Queryable... affectedQueryables) {
	final SessionFactoryImplementor factory = session.getFactory();
	final LinkedHashSet<String> spacesList = new LinkedHashSet<String>();
	for ( Queryable persister : affectedQueryables ) {
		spacesList.addAll( Arrays.asList( (String[]) persister.getQuerySpaces() ) );

		if ( persister.hasCache() ) {
			entityCleanups.add( new EntityCleanup( persister.getCacheAccessStrategy() ) );
		}
		if ( persister.hasNaturalIdentifier() && persister.hasNaturalIdCache() ) {
			naturalIdCleanups.add( new NaturalIdCleanup( persister.getNaturalIdCacheAccessStrategy() ) );
		}

		final Set<String> roles = factory.getCollectionRolesByEntityParticipant( persister.getEntityName() );
		if ( roles != null ) {
			for ( String role : roles ) {
				final CollectionPersister collectionPersister = factory.getCollectionPersister( role );
				if ( collectionPersister.hasCache() ) {
					collectionCleanups.add( new CollectionCleanup( collectionPersister.getCacheAccessStrategy() ) );
				}
			}
		}
	}

	this.affectedTableSpaces = spacesList.toArray( new String[ spacesList.size() ] );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:37,代码来源:BulkOperationCleanupAction.java

示例9: updatePlotter

import java.util.LinkedHashSet; //导入方法依赖的package包/类
@Override
protected void updatePlotter() {
	int categoryCount = prepareData();
	String maxClassesProperty = ParameterService
			.getParameterValue(MainFrame.PROPERTY_RAPIDMINER_GUI_PLOTTER_COLORS_CLASSLIMIT);
	int maxClasses = 20;
	try {
		if (maxClassesProperty != null) {
			maxClasses = Integer.parseInt(maxClassesProperty);
		}
	} catch (NumberFormatException e) {
		// LogService.getGlobal().log("Series plotter: cannot parse property 'rapidminer.gui.plotter.colors.classlimit', using maximal 20 different classes.",
		// LogService.WARNING);
		LogService.getRoot().log(Level.WARNING,
				"com.rapidminer.gui.plotter.charts.SeriesChartPlotter.parsing_property_error");
	}
	boolean createLegend = categoryCount > 0 && categoryCount < maxClasses;

	JFreeChart chart = createChart(this.dataset, createLegend);

	// set the background color for the chart...
	chart.setBackgroundPaint(Color.white);

	// domain axis
	if (axis[INDEX] >= 0) {
		if (!dataTable.isNominal(axis[INDEX])) {
			if (dataTable.isDate(axis[INDEX]) || dataTable.isDateTime(axis[INDEX])) {
				DateAxis domainAxis = new DateAxis(dataTable.getColumnName(axis[INDEX]));
				domainAxis.setTimeZone(Tools.getPreferredTimeZone());
				chart.getXYPlot().setDomainAxis(domainAxis);
				if (getRangeForDimension(axis[INDEX]) != null) {
					domainAxis.setRange(getRangeForDimension(axis[INDEX]));
				}
				domainAxis.setLabelFont(LABEL_FONT_BOLD);
				domainAxis.setTickLabelFont(LABEL_FONT);
				domainAxis.setVerticalTickLabels(isLabelRotating());
			}
		} else {
			LinkedHashSet<String> values = new LinkedHashSet<String>();
			for (DataTableRow row : dataTable) {
				String stringValue = dataTable.mapIndex(axis[INDEX], (int) row.getValue(axis[INDEX]));
				if (stringValue.length() > 40) {
					stringValue = stringValue.substring(0, 40);
				}
				values.add(stringValue);
			}
			ValueAxis categoryAxis = new SymbolAxis(dataTable.getColumnName(axis[INDEX]),
					values.toArray(new String[values.size()]));
			categoryAxis.setLabelFont(LABEL_FONT_BOLD);
			categoryAxis.setTickLabelFont(LABEL_FONT);
			categoryAxis.setVerticalTickLabels(isLabelRotating());
			chart.getXYPlot().setDomainAxis(categoryAxis);
		}
	}

	// legend settings
	LegendTitle legend = chart.getLegend();
	if (legend != null) {
		legend.setPosition(RectangleEdge.TOP);
		legend.setFrame(BlockBorder.NONE);
		legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
		legend.setItemFont(LABEL_FONT);
	}

	AbstractChartPanel panel = getPlotterPanel();
	if (panel == null) {
		panel = createPanel(chart);
	} else {
		panel.setChart(chart);
	}

	// ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!!
	panel.getChartRenderingInfo().setEntityCollection(null);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:75,代码来源:SeriesChartPlotter.java

示例10: AggregatedClassLoader

import java.util.LinkedHashSet; //导入方法依赖的package包/类
private AggregatedClassLoader(final LinkedHashSet<ClassLoader> orderedClassLoaderSet) {
	super( null );
	individualClassLoaders = orderedClassLoaderSet.toArray( new ClassLoader[orderedClassLoaderSet.size()] );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:ClassLoaderServiceImpl.java


注:本文中的java.util.LinkedHashSet.toArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。