java.util.SortedSet.isEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(131)

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

SortedSet.isEmpty介绍

暂无

代码示例

代码示例来源:origin: google/guava

@Override
 protected SortedSet<Integer> create(Integer[] elements) {
  SortedSet<Integer> set = nullCheckedTreeSet(elements);
  int tooHigh = set.isEmpty() ? 0 : set.last() + 1;
  set.add(tooHigh);
  return checkedCreate(set).headSet(tooHigh);
 }
}

代码示例来源:origin: apache/storm

@Override
public KinesisMessageId getNextFailedMessageToRetry() {
  KinesisMessageId result = null;
  // return the first message to be retried from the set. It will return the message with the earliest retry time <= current time
  if (!retryMessageSet.isEmpty() ) {
    result = retryMessageSet.first();
    if (!(retryTimes.get(result) <= System.nanoTime())) {
      result = null;
    }
  }
  LOG.debug("Returning {} to spout for retrying.", result);
  return result;
}

代码示例来源:origin: google/guava

@Override
 protected SortedSet<Integer> create(Integer[] elements) {
  SortedSet<Integer> set = nullCheckedTreeSet(elements);
  int tooLow = set.isEmpty() ? 0 : set.first() - 1;
  set.add(tooLow);
  return checkedCreate(set).tailSet(tooLow + 1);
 }
}

代码示例来源:origin: opentripplanner/OpenTripPlanner

for(Timetable timetable : sortedTimetables) {
  if(serviceDate.compareTo(timetable.serviceDate) < 0) {
    toKeepTimetables.add(timetable);
  } else {
    modified = true;
if(toKeepTimetables.isEmpty()) {
  it.remove();
} else {

代码示例来源:origin: google/guava

@Override
 protected SortedSet<Integer> create(Integer[] elements) {
  SortedSet<Integer> set = nullCheckedTreeSet(elements);
  if (set.isEmpty()) {
   /*
    * The (tooLow + 1, tooHigh) arguments below would be invalid because tooLow would be
    * greater than tooHigh.
    */
   return ContiguousSet.create(Range.openClosed(0, 1), DiscreteDomain.integers()).subSet(0, 1);
  }
  int tooHigh = set.last() + 1;
  int tooLow = set.first() - 1;
  set.add(tooHigh);
  set.add(tooLow);
  return checkedCreate(set).subSet(tooLow + 1, tooHigh);
 }
}

代码示例来源:origin: Sable/soot

queue.add(o);
while (!queue.isEmpty()) {
 SootMethod m = queue.first();
 queue.remove(m);
 S newSummary = newInitialSummary();

代码示例来源:origin: plutext/docx4j

if (inclusiveNSSet != null && !inclusiveNSSet.isEmpty()) {
  visiblyUtilized.addAll(inclusiveNSSet);
        visiblyUtilized.add(prefix);
      result.add(attribute);
    } else if (!(XML.equals(NName) && XML_LANG_URI.equals(NNodeValue))
      && ns.addMapping(NName, NNodeValue, attribute) 
  prefix = XMLNS;
visiblyUtilized.add(prefix);

代码示例来源:origin: internetarchive/heritrix3

private static String last(SortedSet<String> set) {
  return set.isEmpty() ? null : set.last();
}

代码示例来源:origin: Graylog2/graylog2-server

public Configuration(Set<Pipeline> pipelines) {
  if (pipelines.isEmpty()) {
    initialStage = extent[0] = extent[1] = 0;
    return;
  }
  pipelines.forEach(pipeline -> {
    // skip pipelines without any stages, they don't contribute any rules to run
    final SortedSet<Stage> stages = pipeline.stages();
    if (stages.isEmpty()) {
      return;
    }
    extent[0] = Math.min(extent[0], stages.first().stage());
    extent[1] = Math.max(extent[1], stages.last().stage());
    stages.forEach(stage -> stageMultimap.put(stage.stage(), stage));
  });
  if (extent[0] == Integer.MIN_VALUE) {
    throw new IllegalArgumentException("First stage cannot be at " + Integer.MIN_VALUE);
  }
  // the stage before the first stage.
  initialStage = extent[0] - 1;
}

代码示例来源:origin: apache/incubator-druid

sortedIntervals = new TreeSet<>(Comparators.intervalsByStartThenEnd());
 for (Interval interval : intervals) {
  sortedIntervals.add(interval);
if (sortedIntervals.isEmpty()) {
 return new ArrayList<>();

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

public static String getFirstLocalNonLoopbackIpAddress() {
  SortedSet<String> addresses = new TreeSet<>();
  for (NetworkInterface networkInterface : localInterfaces) {
    Enumeration<InetAddress> inetAddressEnumeration = networkInterface.getInetAddresses();
    while (inetAddressEnumeration.hasMoreElements()) {
      InetAddress address = inetAddressEnumeration.nextElement();
      if (!address.isLoopbackAddress() && !address.getHostAddress().contains(":")) {
        addresses.add(address.getHostAddress());
      }
    }
  }
  if (addresses.isEmpty()) {
    throw new RuntimeException("Failed to get non-loopback local ip address!");
  }
  return addresses.first();
}

代码示例来源:origin: apache/kylin

private static String getFileName(String homePath, Pattern pattern) {
  File home = new File(homePath);
  SortedSet<String> files = Sets.newTreeSet();
  if (home.exists() && home.isDirectory()) {
    File[] listFiles = home.listFiles();
    if (listFiles != null) {
      for (File file : listFiles) {
        final Matcher matcher = pattern.matcher(file.getName());
        if (matcher.matches()) {
          files.add(file.getAbsolutePath());
        }
      }
    }
  }
  if (files.isEmpty()) {
    throw new RuntimeException("cannot find " + pattern.toString() + " in " + homePath);
  } else {
    return files.last();
  }
}

代码示例来源:origin: goldmansachs/gs-collections

public T first()
{
  if (this.delegate.isEmpty())
  {
    throw new NoSuchElementException();
  }
  return this.delegate.first();
}

代码示例来源:origin: apache/zookeeper

sortedNames.add(new ZNodeName(dir + "/" + name));
ownerId = sortedNames.first().getName();
SortedSet<ZNodeName> lessThanMe = sortedNames.headSet(idName);
if (!lessThanMe.isEmpty()) {
  ZNodeName lastChildName = lessThanMe.last();
  lastChildId = lastChildName.getName();
  if (LOG.isDebugEnabled()) {

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

existingFeatures.addAll(s);
LayoutFeature prevF = existingFeatures.isEmpty() ? null :
  existingFeatures.first();
for (LayoutFeature f : features) {
 final FeatureInfo info = f.getInfo();
 if (info.getSpecialFeatures() != null) {
  for (LayoutFeature specialFeature : info.getSpecialFeatures()) {
   featureSet.add(specialFeature);
 featureSet.add(f);
 map.put(info.getLayoutVersion(), featureSet);

代码示例来源:origin: apache/hive

SortedSet<ReduceSinkOperator> semiJoinRsOps = new TreeSet<>(rsOpComp);
semiJoinRsOps.addAll(map.keySet());
while (!semiJoinRsOps.isEmpty()) {
      semiJoinRsOpsNewIter.add(prevResult.rsOperator);
      if (LOG.isDebugEnabled()) {
       LOG.debug("Adding " + OperatorUtils.getOpNamePretty(prevResult.rsOperator)
      semiJoinRsOpsNewIter.add(rs);
      if (LOG.isDebugEnabled()) {
       LOG.debug("Adding " + OperatorUtils.getOpNamePretty(rs) + " for re-iteration");

代码示例来源:origin: goldmansachs/gs-collections

public T last()
{
  if (this.delegate.isEmpty())
  {
    throw new NoSuchElementException();
  }
  return this.delegate.last();
}

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

if (!dataPoints.isEmpty()) {
  low = dataPoints.first().getScore();
  high = dataPoints.last().getScore();

代码示例来源:origin: Alluxio/alluxio

throws JobDoesNotExistException, ResourceExhaustedException {
if (mIdToJobCoordinator.size() == mCapacity) {
 if (mFinishedJobs.isEmpty()) {
   mFinishedJobs.remove(jobInfo);
   if (status.isFinished()) {
    mFinishedJobs.add(jobInfo);

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

&& contract != ExceptionMapper.class) {
    mapperTypes.add((Class<? extends ExceptionMapper>) contract);
if (!mapperTypes.isEmpty()) {
  final Class<? extends Throwable> c = getExceptionType(mapperTypes.first());
  if (c != null) {
    exceptionMapperTypes.add(new ExceptionMapperType(mapperHandle, c));

相关文章