本文整理了Java中java.util.SortedSet.clear()
方法的一些代码示例,展示了SortedSet.clear()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SortedSet.clear()
方法的具体详情如下:
包路径:java.util.SortedSet
类名称:SortedSet
方法名:clear
暂无
代码示例来源:origin: apache/hbase
@Override
// called between every row.
public void reset() {
hasFamilyStamp = false;
familyStamp = 0L;
familyVersionStamps.clear();
deleteCell = null;
}
代码示例来源:origin: oracle/opengrok
/**
* Remove list of files.
*/
public void stripFiles() {
files.clear();
}
代码示例来源:origin: checkstyle/checkstyle
/**
* Clears the sorted set of {@link LocalizedMessage} of the check.
*/
public final void clearMessages() {
context.get().messages.clear();
}
代码示例来源:origin: wildfly/wildfly
/**
* remove all the pending messages
*/
public void clear() {
synchronized (deliverySet) {
deliverySet.clear();
messageCache.clear();
}
}
代码示例来源:origin: log4j/log4j
/**
* Clear the list of all events.
*/
public void clear() {
synchronized (mLock) {
mAllEvents.clear();
mFilteredEvents = new EventDetails[0];
mPendingEvents.clear();
fireTableDataChanged();
}
}
代码示例来源:origin: internetarchive/heritrix3
/**
* Collect all rule-based SheetAssociations. Typically autowired
* from the set of all DecideRuledSheetAssociation instances.
*/
@Autowired(required=false)
public void addRuleAssociations(Set<DecideRuledSheetAssociation> associations) {
// always keep sorted by order
this.ruleAssociations.clear();
this.ruleAssociations.addAll(associations);
}
代码示例来源:origin: checkstyle/checkstyle
/**
* Notify all listeners about the errors in a file.
* Calls {@code MessageDispatcher.fireErrors()} with
* all logged errors and than clears errors' list.
* @param fileName the audited file
*/
protected final void fireErrors(String fileName) {
final SortedSet<LocalizedMessage> errors = new TreeSet<>(MESSAGE_COLLECTOR.get());
MESSAGE_COLLECTOR.get().clear();
messageDispatcher.fireErrors(fileName, errors);
}
代码示例来源:origin: checkstyle/checkstyle
@Override
public final SortedSet<LocalizedMessage> process(File file, FileText fileText)
throws CheckstyleException {
final SortedSet<LocalizedMessage> messages = MESSAGE_COLLECTOR.get();
messages.clear();
// Process only what interested in
if (CommonUtil.matchesFileExtension(file, fileExtensions)) {
processFiltered(file, fileText);
}
final SortedSet<LocalizedMessage> result = new TreeSet<>(messages);
messages.clear();
return result;
}
代码示例来源:origin: jenkinsci/jenkins
private void renameViewItem(String oldFullName, String newFullName, ViewGroup vg, ListView lv) {
boolean needsSave;
synchronized (lv) {
Set<String> oldJobNames = new HashSet<String>(lv.jobNames);
lv.jobNames.clear();
for (String oldName : oldJobNames) {
lv.jobNames.add(Items.computeRelativeNamesAfterRenaming(oldFullName, newFullName, oldName, vg.getItemGroup()));
}
needsSave = !oldJobNames.equals(lv.jobNames);
}
if (needsSave) { // do not hold ListView lock at the time
try {
lv.save();
} catch (IOException x) {
Logger.getLogger(ListView.class.getName()).log(Level.WARNING, null, x);
}
}
}
代码示例来源:origin: apache/geode
/**
* @return a list of region names hosted on the system
*/
public String[] listAllRegionPaths() {
if (distrRegionMap.values().size() == 0) {
return ManagementConstants.NO_DATA_STRING;
}
// Sort region paths
SortedSet<String> regionPathsSet = new TreeSet<>();
for (DistributedRegionBridge bridge : distrRegionMap.values()) {
regionPathsSet.add(bridge.getFullPath());
}
String[] regionPaths = new String[regionPathsSet.size()];
regionPaths = regionPathsSet.toArray(regionPaths);
regionPathsSet.clear();
return regionPaths;
}
代码示例来源:origin: apache/nifi
@OnScheduled
public void initialize(final ProcessContext context) {
attachments.clear();
for (Map.Entry<PropertyDescriptor, String> property : context.getProperties().entrySet()) {
PropertyDescriptor descriptor = property.getKey();
if (descriptor.isDynamic()) {
attachments.add(descriptor);
}
}
}
代码示例来源:origin: org.apache.commons/commons-collections4
/**
* Factory method to create a transforming sorted set that will transform
* existing contents of the specified sorted set.
* <p>
* If there are any elements already in the set being decorated, they
* will be transformed by this method.
* Contrast this with {@link #transformingSortedSet(SortedSet, Transformer)}.
*
* @param <E> the element type
* @param set the set to decorate, must not be null
* @param transformer the transformer to use for conversion, must not be null
* @return a new transformed {@link SortedSet}
* @throws NullPointerException if set or transformer is null
* @since 4.0
*/
public static <E> TransformedSortedSet<E> transformedSortedSet(final SortedSet<E> set,
final Transformer<? super E, ? extends E> transformer) {
final TransformedSortedSet<E> decorated = new TransformedSortedSet<>(set, transformer);
if (set.size() > 0) {
@SuppressWarnings("unchecked") // set is type E
final E[] values = (E[]) set.toArray(); // NOPMD - false positive for generics
set.clear();
for (final E value : values) {
decorated.decorated().add(transformer.transform(value));
}
}
return decorated;
}
代码示例来源:origin: apache/hbase
syncFutures.clear();
return finished;
} else {
代码示例来源:origin: checkstyle/checkstyle
@Override
protected void processFiltered(File file, FileText fileText) throws CheckstyleException {
// check if already checked and passed the file
if (!ordinaryChecks.isEmpty() || !commentChecks.isEmpty()) {
final FileContents contents = new FileContents(fileText);
final DetailAST rootAST = JavaParser.parse(contents);
if (!ordinaryChecks.isEmpty()) {
walk(rootAST, contents, AstState.ORDINARY);
}
if (!commentChecks.isEmpty()) {
final DetailAST astWithComments = JavaParser.appendHiddenCommentNodes(rootAST);
walk(astWithComments, contents, AstState.WITH_COMMENTS);
}
if (filters.isEmpty()) {
addMessages(messages);
}
else {
final SortedSet<LocalizedMessage> filteredMessages =
getFilteredMessages(file.getAbsolutePath(), contents, rootAST);
addMessages(filteredMessages);
}
messages.clear();
}
}
代码示例来源:origin: cSploit/android
public static void reset() {
mCurrentTarget = null;
synchronized (mTargets) {
mTargets.clear();
Target network, gateway, device;
network = new Target(mNetwork);
device = new Target(mNetwork.getLocalAddress(), mNetwork.getLocalHardware());
device.setAlias(android.os.Build.MODEL);
mTargets.add(network);
if(mNetwork.haveGateway()) {
gateway = new Target(mNetwork.getGatewayAddress(), mNetwork.getGatewayHardware());
gateway.setAlias(mNetwork.getSSID());
mTargets.add(gateway);
}
mTargets.add(device);
scanThemAll();
}
notifyTargetListChanged();
}
代码示例来源:origin: google/guava
public void testElementSetSubsetClear() {
TreeMultiset<String> ms = TreeMultiset.create();
ms.add("a", 1);
ms.add("b", 3);
ms.add("c", 2);
ms.add("d", 1);
ms.add("e", 3);
ms.add("f", 2);
SortedSet<String> elementSet = ms.elementSet();
assertThat(elementSet).containsExactly("a", "b", "c", "d", "e", "f").inOrder();
SortedSet<String> subset = elementSet.subSet("b", "f");
assertThat(subset).containsExactly("b", "c", "d", "e").inOrder();
subset.clear();
assertThat(elementSet).containsExactly("a", "f").inOrder();
assertThat(subset).isEmpty();
assertEquals(3, ms.size());
}
代码示例来源:origin: pmd/pmd
dataPoints.clear();
代码示例来源:origin: jenkinsci/jenkins
synchronized (this) {
recurse = json.optBoolean("recurse", true);
jobNames.clear();
Iterable<? extends TopLevelItem> items;
if (recurse) {
代码示例来源:origin: google/guava
public void testTailSetClear() {
TreeMultimap<String, Integer> multimap = TreeMultimap.create();
multimap.put("a", 1);
multimap.put("a", 11);
multimap.put("b", 2);
multimap.put("c", 3);
multimap.put("d", 4);
multimap.put("e", 5);
multimap.put("e", 55);
multimap.keySet().tailSet("d").clear();
assertEquals(ImmutableSet.of("a", "b", "c"), multimap.keySet());
assertEquals(4, multimap.size());
assertEquals(4, multimap.values().size());
assertEquals(4, multimap.keys().size());
}
代码示例来源:origin: cSploit/android
public static void clean(boolean releaseLocks) {
setForwarding(false);
try {
if (releaseLocks) {
Logger.debug("Releasing locks.");
if (mWifiLock != null && mWifiLock.isHeld())
mWifiLock.release();
if (mWakeLock != null && mWakeLock.isHeld())
mWakeLock.release();
}
RemoteReader.terminateAll();
GitHubParser.resetAll();
synchronized (mTargets) {
for (Target t : mTargets)
for (Session s : t.getSessions())
s.stopSession();
mTargets.clear();
}
Client.Disconnect();
mCoreInitialized = false;
mInitialized = false;
Services.getNetworkRadar().onAutoScanChanged();
} catch (Exception e) {
errorLogging(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!