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


Java LinkedHashSet.isEmpty方法代码示例

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


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

示例1: unregisterThrower

import java.util.LinkedHashSet; //导入方法依赖的package包/类
public void unregisterThrower(Class<?> interfaceClass, IEventThrower<?> thrower, boolean keepSubscribers){
	synchronized (EVENT_THROWERS) {
		if(EVENT_THROWERS.containsKey(interfaceClass)){
			LinkedHashSet<IEventThrower<?>> list = EVENT_THROWERS.get(interfaceClass);
			if(keepSubscribers){
				Queue<Object> toKeep = new ArrayDeque<>();
				Iterator<?> subscribers = thrower.getSubscribers();
				while(subscribers.hasNext()){
					Object listener = subscribers.next();
					toKeep.add(listener);
				}
				if(!QUEUED_LISTENERS.containsKey(interfaceClass)){
					QUEUED_LISTENERS.put(interfaceClass, toKeep);
				}
			}else{
				thrower.clearSubscribers();
			}
			list.remove(thrower);
			if(list.isEmpty()){
				EVENT_THROWERS.remove(interfaceClass);	
			}
		}
	}
}
 
开发者ID:dbteku,项目名称:JavaEvents,代码行数:25,代码来源:EventManager.java

示例2: computeMorePairs

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * Computes more critical pairs for this set
 * @return a nonempty set of Critical pairs if there were more critical pairs.
 * Otherwise an empty set (this means that this.ruleTuples.isEmpty after this call)
 */
private Set<CriticalPair> computeMorePairs() {
    LinkedHashSet<CriticalPair> result = new LinkedHashSet<>(0);
    if (!this.ruleTuplesToProcess.isEmpty()) {
        Iterator<RuleTuple> it = this.ruleTuplesToProcess.iterator();
        while (result.isEmpty() && it.hasNext()) {
            RuleTuple nextTuple = it.next();
            result = CriticalPair.computeCriticalPairs(nextTuple.rule1, nextTuple.rule2);
            //Add the new pairs to the internal set
            this.pairMap.put(nextTuple, result);
            //remove the tuple
            it.remove();
        }
    }
    //return the new pairs
    return result;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:22,代码来源:LazyCriticalPairSet.java

示例3: getEarliest

import java.util.LinkedHashSet; //导入方法依赖的package包/类
public static PacketInfo getEarliest(LinkedHashSet<PacketInfo> packetInfos) {
    if ((packetInfos == null) || (packetInfos.isEmpty())) {
        throw new IllegalArgumentException("Cannot get earliest of null or empty PacketInfo set!");
    }
    PacketInfo earliest = null;
    Timestamp earliestTimestamp = null;
    for (PacketInfo current : packetInfos) {
        if (earliest == null) {
            earliest = current;
            earliestTimestamp = Timestamp.valueOf(current.get(PacketInfo.TIMESTAMP));
        } else {
            Timestamp currentTimestamp = Timestamp.valueOf(current.get(PacketInfo.TIMESTAMP));
            if (currentTimestamp.before(earliestTimestamp)) {
                earliest = current;
                earliestTimestamp = currentTimestamp;
            }
        }
    }
    return earliest;
}
 
开发者ID:rmcnew,项目名称:LiquidFortressPacketAnalyzer,代码行数:21,代码来源:PacketInfoUtils.java

示例4: getLatest

import java.util.LinkedHashSet; //导入方法依赖的package包/类
public static PacketInfo getLatest(LinkedHashSet<PacketInfo> packetInfos) {
    if ((packetInfos == null) || (packetInfos.isEmpty())) {
        throw new IllegalArgumentException("Cannot get latest of null or empty PacketInfo set!");
    }
    PacketInfo latest = null;
    Timestamp latestTimestamp = null;
    for (PacketInfo current : packetInfos) {
        if (latest == null) {
            latest = current;
            latestTimestamp = Timestamp.valueOf(current.get(PacketInfo.TIMESTAMP));
        } else {
            Timestamp currentTimestamp = Timestamp.valueOf(current.get(PacketInfo.TIMESTAMP));
            if (currentTimestamp.after(latestTimestamp)) {
                latest = current;
                latestTimestamp = currentTimestamp;
            }
        }
    }
    return latest;
}
 
开发者ID:rmcnew,项目名称:LiquidFortressPacketAnalyzer,代码行数:21,代码来源:PacketInfoUtils.java

示例5: removeTransformer

import java.util.LinkedHashSet; //导入方法依赖的package包/类
@Override
public synchronized void removeTransformer(Bundle pBundle, ClassTransformer transformer) {
    LinkedHashSet<ClassTransformer> set = registeredTransformers.get(pBundle);
    if (set == null || !set.remove(transformer)) {
        throw new IllegalStateException("Transformer " + transformer + " not registered");
    }
    if (set.isEmpty()) {
        registeredTransformers.remove(pBundle);
    }
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:11,代码来源:JPAWeavingHook.java

示例6: filterPolicySetsByPriority

import java.util.LinkedHashSet; //导入方法依赖的package包/类
LinkedHashSet<PolicySet> filterPolicySetsByPriority(final String subjectIdentifier, final String uri,
        final List<PolicySet> allPolicySets, final LinkedHashSet<String> policySetsEvaluationOrder)
        throws IllegalArgumentException {

    if (policySetsEvaluationOrder.isEmpty()) {
        if (allPolicySets.size() > 1) {
            LOGGER.error(
                    "Found more than one policy set during policy evaluation and "
                            + "no evaluation order is provided. subjectIdentifier='{}', resourceURI='{}'",
                    subjectIdentifier, uri);
            throw new IllegalArgumentException("More than one policy set exists for this zone. "
                    + "Please provide an ordered list of policy set names to consider for this evaluation and "
                    + "resubmit the request.");
        } else {
            return new LinkedHashSet<>(allPolicySets);
        }
    }

    Map<String, PolicySet> allPolicySetsMap = allPolicySets.stream()
            .collect(Collectors.toMap(PolicySet::getName, Function.identity()));
    LinkedHashSet<PolicySet> filteredPolicySets = new LinkedHashSet<>();
    for (String policySetId : policySetsEvaluationOrder) {
        PolicySet policySet = allPolicySetsMap.get(policySetId);
        if (policySet == null) {
            LOGGER.error("No existing policy set matches policy set in the evaluation order of the request. "
                    + "Subject: {}, Resource: {}", subjectIdentifier, uri);
            throw new IllegalArgumentException(
                    "No existing policy set matches policy set in the evaluaion order of the request. "
                            + "Please review the policy evauation order and resubmit the request.");
        } else {
            filteredPolicySets.add(policySet);
        }
    }
    return filteredPolicySets;
}
 
开发者ID:eclipse,项目名称:keti,代码行数:36,代码来源:PolicyEvaluationServiceImpl.java

示例7: createDocComment

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * 
 */
private String[] createDocComment(boolean hasReturnType,
        LinkedHashSet<TypeDescriptor> throwsTypes,
        String[] methodDescription, String returnTypeDescription) {
    
    ArrayList<String> lines = new ArrayList<>();
    
    if (methodDescription != null) {
        for (int i=0;i<methodDescription.length;i++) {
            lines.add(methodDescription[i]);
        }
    }
    
    boolean hasThrowTypes = !throwsTypes.isEmpty();
    
    if ((methodDescription != null) && (methodDescription.length > 0) &&
        (hasReturnType || hasThrowTypes)) {
        
        lines.add("");
    }
    
    if (hasReturnType) {
        lines.add("@return "+returnTypeDescription);
    }
    
    if (hasThrowTypes) {
        Iterator<TypeDescriptor> iterator = throwsTypes.iterator();
        
        while (iterator.hasNext()) {
            TypeDescriptor curType = iterator.next();
            String typeName = curType.getSimpleName();
            String typeDescription = getThrowableDescription(curType);
            
            lines.add("@throws "+typeName+" "+typeDescription);
        }
    }
    
    return lines.toArray(SystemToolkit.EMPTY_STRING_ARRAY);
}
 
开发者ID:annoflex,项目名称:annoflex,代码行数:42,代码来源:ScannerGenerator.java

示例8: interfaceApiSupertypeWalker

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * This methods takes an API-Element and pulls the projectComparisons along the suptertype chain.
 *
 * Does nothing if apiElement is null.
 *
 * @param filter
 *            applied to each encountered projectComparison
 * @param actionProvider
 *            function to apply on filtered ProjectComparinsonEntries.
 * @param apiElement
 *            concrete API element to start from.
 */
public <T extends TClassifier> void interfaceApiSupertypeWalker(Predicate<? super ProjectComparisonEntry> filter,
		Function<T, Consumer<? super ProjectComparisonEntry>> actionProvider,
		ProjectComparisonAdapter projectComparisonAdapter, /* ProjectComparisonEntry compareEntry, */
		T apiElement, Class<T> castGuard) {
	if (apiElement == null) {
		// no apiElemnt means no one can directly call the concrete implementation
		// from projects
		return;
	}

	LinkedHashSet<T> toBeProcessedSuperInterfaces = new LinkedHashSet<>();
	LinkedHashSet<T> processedSuperInterfaces = new LinkedHashSet<>();
	// Yes it is correct ~Not correct~, since we need VirtualMethods for the direct missing parts:: //
	toBeProcessedSuperInterfaces.add(apiElement);
	// includeAdditionsSuperInterfaces(toBeProcessedSuperInterfaces, processedSuperInterfaces, apiInterface);

	while (!toBeProcessedSuperInterfaces.isEmpty()) {

		Iterator<T> iter = toBeProcessedSuperInterfaces.iterator();
		T pivot = iter.next();
		iter.remove();
		// do not process built-in types
		if (TypeUtils.isBuiltIn(pivot)) {
			continue;
		}
		// collect to be processed:
		includeAdditionsSuperInterfaces2(toBeProcessedSuperInterfaces, processedSuperInterfaces, pivot, castGuard);
		// go over methods.
		// Is the superInterface from the same Project ? If not it cannot be an API problem of this
		// implementation.
		TModule superModule = pivot.getContainingModule();

		if (superModule != null) {
			ProjectComparisonEntry useCompareEntry = projectComparisonAdapter.getEntryFor(superModule);
			if (useCompareEntry == null) {
				if (logger.isDebugEnabled()) {
					logger.debug("No comparison found for pivot = " + pivot.getName());
				}
			} else {
				// Is there an API entry at all ? --> If not it was just a normal implementation of some library ?
				ProjectComparisonEntry superInterfaceCompareEntry = useCompareEntry.getChildForElementAPI(pivot);
				if (superInterfaceCompareEntry != null) {
					// Is there a difference between this API and the implementations ?
					if (superInterfaceCompareEntry.hasChildren()) {
						// get the ones which are missing implementations; others are real errors and will not be
						// touched!
						superInterfaceCompareEntry.allChildren()
								.filter(filter)
								.forEach(actionProvider.apply(pivot));
					}
				} // end if superInterfaceCompareEntry != null
			}
		} // end if null-check for module...
		else {
			if (logger.isDebugEnabled()) {
				logger.debug("-#- could not get module for super-classifier: " + pivot.getName() + " of type "
						+ pivot.getTypeAsString() + " providedByRuntime=" + pivot.isProvidedByRuntime());
			}
		}
	}

}
 
开发者ID:eclipse,项目名称:n4js,代码行数:75,代码来源:ScriptApiTracker.java

示例9: nativeToFlavorLookup

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
 * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
 * case, a new DataFlavor is synthesized, stored, and returned, if and
 * only if the specified native is encoded as a Java MIME type.
 */
private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
    LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);


    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            LinkedHashSet<DataFlavor> platformFlavors =
                transferer.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new LinkedHashSet<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            flavorsForNativeCache.remove(nat);

            LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new LinkedHashSet<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            nativesForFlavorCache.remove(flavor);
        }
    }

    return (flavors != null) ? flavors : new LinkedHashSet<>(0);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:60,代码来源:SystemFlavorMap.java

示例10: flavorToNativeLookup

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * Semantically equivalent to 'flavorToNative.get(flav)'. This method
 * handles the case where 'flav' is not found in 'flavorToNative' depending
 * on the value of passes 'synthesize' parameter. If 'synthesize' is
 * SYNTHESIZE_IF_NOT_FOUND a native is synthesized, stored, and returned by
 * encoding the DataFlavor's MIME type. Otherwise an empty List is returned
 * and 'flavorToNative' remains unaffected.
 */
private LinkedHashSet<String> flavorToNativeLookup(final DataFlavor flav,
                                                   final boolean synthesize) {

    LinkedHashSet<String> natives = getFlavorToNative().get(flav);

    if (flav != null && !disabledMappingGenerationKeys.contains(flav)) {
        DataTransferer transferer = DataTransferer.getInstance();
        if (transferer != null) {
            LinkedHashSet<String> platformNatives =
                transferer.getPlatformMappingsForFlavor(flav);
            if (!platformNatives.isEmpty()) {
                if (natives != null) {
                    // Prepend the platform-specific mappings to ensure
                    // that the natives added with
                    // addUnencodedNativeForFlavor() are at the end of
                    // list.
                    platformNatives.addAll(natives);
                }
                natives = platformNatives;
            }
        }
    }

    if (natives == null) {
        if (synthesize) {
            String encoded = encodeDataFlavor(flav);
            natives = new LinkedHashSet<>(1);
            getFlavorToNative().put(flav, natives);
            natives.add(encoded);

            LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(encoded);
            if (flavors == null) {
                flavors = new LinkedHashSet<>(1);
                getNativeToFlavor().put(encoded, flavors);
            }
            flavors.add(flav);

            nativesForFlavorCache.remove(flav);
            flavorsForNativeCache.remove(encoded);
        } else {
            natives = new LinkedHashSet<>(0);
        }
    }

    return new LinkedHashSet<>(natives);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:55,代码来源:SystemFlavorMap.java

示例11: nativeToFlavorLookup

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method handles
 * the case where 'nat' is not found in 'nativeToFlavor'. In that case, a
 * new DataFlavor is synthesized, stored, and returned, if and only if the
 * specified native is encoded as a Java MIME type.
 */
private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
    LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);

    if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
        DesktopDatatransferService desktopService = DataFlavorUtil.getDesktopService();
        if (desktopService.isDesktopPresent()) {
            LinkedHashSet<DataFlavor> platformFlavors =
                    desktopService.getPlatformMappingsForNative(nat);
            if (!platformFlavors.isEmpty()) {
                if (flavors != null) {
                    // Prepending the platform-specific mappings ensures
                    // that the flavors added with
                    // addFlavorForUnencodedNative() are at the end of
                    // list.
                    platformFlavors.addAll(flavors);
                }
                flavors = platformFlavors;
            }
        }
    }

    if (flavors == null && isJavaMIMEType(nat)) {
        String decoded = decodeJavaMIMEType(nat);
        DataFlavor flavor = null;

        try {
            flavor = new DataFlavor(decoded);
        } catch (Exception e) {
            System.err.println("Exception \"" + e.getClass().getName() +
                               ": " + e.getMessage()  +
                               "\"while constructing DataFlavor for: " +
                               decoded);
        }

        if (flavor != null) {
            flavors = new LinkedHashSet<>(1);
            getNativeToFlavor().put(nat, flavors);
            flavors.add(flavor);
            flavorsForNativeCache.remove(nat);

            LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
            if (natives == null) {
                natives = new LinkedHashSet<>(1);
                getFlavorToNative().put(flavor, natives);
            }
            natives.add(nat);
            nativesForFlavorCache.remove(flavor);
        }
    }

    return (flavors != null) ? flavors : new LinkedHashSet<>(0);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:59,代码来源:SystemFlavorMap.java

示例12: flavorToNativeLookup

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * Semantically equivalent to 'flavorToNative.get(flav)'. This method
 * handles the case where 'flav' is not found in 'flavorToNative' depending
 * on the value of passes 'synthesize' parameter. If 'synthesize' is
 * SYNTHESIZE_IF_NOT_FOUND a native is synthesized, stored, and returned by
 * encoding the DataFlavor's MIME type. Otherwise an empty List is returned
 * and 'flavorToNative' remains unaffected.
 */
private LinkedHashSet<String> flavorToNativeLookup(final DataFlavor flav,
                                                   final boolean synthesize) {

    LinkedHashSet<String> natives = getFlavorToNative().get(flav);

    if (flav != null && !disabledMappingGenerationKeys.contains(flav)) {
        DesktopDatatransferService desktopService = DataFlavorUtil.getDesktopService();
        if (desktopService.isDesktopPresent()) {
            LinkedHashSet<String> platformNatives =
                    desktopService.getPlatformMappingsForFlavor(flav);
            if (!platformNatives.isEmpty()) {
                if (natives != null) {
                    // Prepend the platform-specific mappings to ensure
                    // that the natives added with
                    // addUnencodedNativeForFlavor() are at the end of
                    // list.
                    platformNatives.addAll(natives);
                }
                natives = platformNatives;
            }
        }
    }

    if (natives == null) {
        if (synthesize) {
            String encoded = encodeDataFlavor(flav);
            natives = new LinkedHashSet<>(1);
            getFlavorToNative().put(flav, natives);
            natives.add(encoded);

            LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(encoded);
            if (flavors == null) {
                flavors = new LinkedHashSet<>(1);
                getNativeToFlavor().put(encoded, flavors);
            }
            flavors.add(flav);

            nativesForFlavorCache.remove(flav);
            flavorsForNativeCache.remove(encoded);
        } else {
            natives = new LinkedHashSet<>(0);
        }
    }

    return new LinkedHashSet<>(natives);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:55,代码来源:SystemFlavorMap.java


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