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


Java SortedSet.isEmpty方法代码示例

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


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

示例1: doSearch

import java.util.SortedSet; //导入方法依赖的package包/类
private int doSearch(Configuration conf, String keysDir) throws Exception {
  Path inputDir = new Path(keysDir);

  getConf().set(SEARCHER_INPUTDIR_KEY, inputDir.toString());
  SortedSet<byte []> keys = readKeysToSearch(getConf());
  if (keys.isEmpty()) throw new RuntimeException("No keys to find");
  LOG.info("Count of keys to find: " + keys.size());
  for(byte [] key: keys)  LOG.info("Key: " + Bytes.toStringBinary(key));
  Path hbaseDir = new Path(getConf().get(HConstants.HBASE_DIR));
  // Now read all WALs. In two dirs. Presumes certain layout.
  Path walsDir = new Path(hbaseDir, HConstants.HREGION_LOGDIR_NAME);
  Path oldWalsDir = new Path(hbaseDir, HConstants.HREGION_OLDLOGDIR_NAME);
  LOG.info("Running Search with keys inputDir=" + inputDir +
    " against " + getConf().get(HConstants.HBASE_DIR));
  int ret = ToolRunner.run(new WALSearcher(getConf()), new String [] {walsDir.toString(), ""});
  if (ret != 0) return ret;
  return ToolRunner.run(new WALSearcher(getConf()), new String [] {oldWalsDir.toString(), ""});
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:IntegrationTestLoadAndVerify.java

示例2: create

import java.util.SortedSet; //导入方法依赖的package包/类
@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);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:17,代码来源:SetGenerators.java

示例3: buildPackageSerializedForm

import java.util.SortedSet; //导入方法依赖的package包/类
/**
 * Build the package serialized form for the current package being processed.
 *
 * @param serializedSummariesTree content tree to which the documentation will be added
 * @throws DocletException if there is a problem while building the documentation
 */
protected void buildPackageSerializedForm(Content serializedSummariesTree) throws DocletException {
    Content packageSerializedTree = writer.getPackageSerializedHeader();
    SortedSet<TypeElement> classes = utils.getAllClassesUnfiltered(currentPackage);
    if (classes.isEmpty()) {
        return;
    }
    if (!serialInclude(utils, currentPackage)) {
        return;
    }
    if (!serialClassFoundToDocument(classes)) {
        return;
    }

    buildPackageHeader(packageSerializedTree);
    buildClassSerializedForm(packageSerializedTree);

    writer.addPackageSerializedTree(serializedSummariesTree, packageSerializedTree);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:SerializedFormBuilder.java

示例4: getMostCompatibleMethod

import java.util.SortedSet; //导入方法依赖的package包/类
public IMethod getMostCompatibleMethod(String name, ISignature signature) {
  IMethod result = null;

  SortedSet compatibleMethods
    = new TreeSet(new MethodSpecificityComparator());

  Iterator it = getMethods().iterator();
  while (it.hasNext()) {
    IMethod method = (IMethod)it.next();
    if ( name.equals( method.getName() ) ) {
      if ( method.hasCompatibleSignature( signature ) ) {
        compatibleMethods.add(method);
      }
    }
  }

  if (!compatibleMethods.isEmpty()) {
    result = (IMethod)compatibleMethods.first();
  }

  return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:ExternalClass.java

示例5: testAllVersionsTested

import java.util.SortedSet; //导入方法依赖的package包/类
public void testAllVersionsTested() throws Exception {
    SortedSet<String> expectedVersions = new TreeSet<>();
    for (Version v : VersionUtils.allReleasedVersions()) {
        if (VersionUtils.isSnapshot(v)) continue;  // snapshots are unreleased, so there is no backcompat yet
        if (v.isRelease() == false) continue; // no guarantees for prereleases
        if (v.before(Version.CURRENT.minimumIndexCompatibilityVersion())) continue; // we can only support one major version backward
        if (v.equals(Version.CURRENT)) continue; // the current version is always compatible with itself
        expectedVersions.add("index-" + v.toString() + ".zip");
    }

    for (String index : indexes) {
        if (expectedVersions.remove(index) == false) {
            logger.warn("Old indexes tests contain extra index: {}", index);
        }
    }
    if (expectedVersions.isEmpty() == false) {
        StringBuilder msg = new StringBuilder("Old index tests are missing indexes:");
        for (String expected : expectedVersions) {
            msg.append("\n" + expected);
        }
        fail(msg.toString());
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:OldIndexBackwardsCompatibilityIT.java

示例6: get

import java.util.SortedSet; //导入方法依赖的package包/类
/**
 * Return the ith element of a set. Super lame
 * 
 * @param <T>
 * @param items
 * @param idx
 * @return
 */
public static <T> T get(Iterable<T> items, int idx) {
    if (items == null) {
        return (null);
    }
    else if (items instanceof List<?>) {
        return ((List<T>) items).get(idx);
    }
    else if (items instanceof ListOrderedSet<?>) {
        return ((ListOrderedSet<T>) items).get(idx);
    }
    else if (items instanceof SortedSet<?> && idx == 0) {
        SortedSet<T> set = (SortedSet<T>)items;
        return (set.isEmpty() ? null : set.first());
    }
    int ctr = 0;
    for (T t : items) {
        if (ctr++ == idx) return (t);
    }
    return (null);
}
 
开发者ID:s-store,项目名称:s-store,代码行数:29,代码来源:CollectionUtil.java

示例7: EncodingNode

import java.util.SortedSet; //导入方法依赖的package包/类
public EncodingNode(String[] ids, CodeSequence[] seqs) {
	SortedSet<String> idSet = new TreeSet<String>();
	SortedSet<String> nidSet = new TreeSet<String>();
	for (int i = 0; i < ids.length; i++) {
		String nid = ids[i].toLowerCase().replaceAll("[^a-z0-9]+", "");
		if (ids[i].length() > 0 && nid.length() > 0) {
			if (idSet.contains(ids[i])) throw new IllegalArgumentException("Duplicate id: " + ids[i]);
			if (nidSet.contains(nid)) throw new IllegalArgumentException("Duplicate id:" + nid);
			idSet.add(ids[i]);
			nidSet.add(nid);
		}
	}
	if (idSet.isEmpty() || nidSet.isEmpty()) throw new IllegalArgumentException("No ids");
	this.ids = idSet.toArray(new String[idSet.size()]);
	this.nids = nidSet.toArray(new String[nidSet.size()]);
	SortedSet<CodeSequence> seqSet = new TreeSet<CodeSequence>();
	for (int i = 0; i < seqs.length; i++) {
		if (seqs[i].length() > 0) {
			if (seqSet.contains(seqs[i])) throw new IllegalArgumentException("Duplicate code sequence: " + seqs[i]);
			seqSet.add(seqs[i]);
		}
	}
	if (seqSet.isEmpty()) throw new IllegalArgumentException("No code sequences");
	this.seqs = seqSet.toArray(new CodeSequence[seqSet.size()]);
}
 
开发者ID:kreativekorp,项目名称:vexillo,代码行数:26,代码来源:EncodingNode.java

示例8: buildClassSummary

import java.util.SortedSet; //导入方法依赖的package包/类
/**
 * Build the summary for the classes in this package.
 *
 * @param summaryContentTree the summary tree to which the class summary will
 *                           be added
 */
protected void buildClassSummary(Content summaryContentTree) {
    String classTableSummary =
            configuration.getText("doclet.Member_Table_Summary",
            configuration.getText("doclet.Class_Summary"),
            configuration.getText("doclet.classes"));
    List<String> classTableHeader = Arrays.asList(configuration.getText("doclet.Class"),
            configuration.getText("doclet.Description"));
    SortedSet<TypeElement> clist = utils.isSpecified(packageElement)
        ? utils.getTypeElementsAsSortedSet(utils.getOrdinaryClasses(packageElement))
        : configuration.typeElementCatalog.ordinaryClasses(packageElement);
    SortedSet<TypeElement> classes = utils.filterOutPrivateClasses(clist, configuration.javafx);
    if (!classes.isEmpty()) {
        packageWriter.addClassesSummary(classes,
                configuration.getText("doclet.Class_Summary"),
                classTableSummary, classTableHeader, summaryContentTree);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:PackageSummaryBuilder.java

示例9: getMostCompatibleMethod

import java.util.SortedSet; //导入方法依赖的package包/类
public IMethod getMostCompatibleMethod(String name, ISignature signature) {
    IMethod result = null;

    SortedSet compatibleMethods =
        new TreeSet(new MethodSpecificityComparator());

    Iterator it = methods.iterator();
    while (it.hasNext()) {
        MethodDef method = (MethodDef) it.next();
        if (name.equals(method.getName())) {
            if (method.hasCompatibleSignature(signature)) {
                compatibleMethods.add(method);
            }
        }
    }

    if (!compatibleMethods.isEmpty()) {
        result = (IMethod) compatibleMethods.first();
    }

    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:ClassDef.java

示例10: floor

import java.util.SortedSet; //导入方法依赖的package包/类
/**
 * Return the largest key in this set <= k.
 */
public Key floor(Key k) {
    if (set.contains(k)) return k;

    // does not include key if present (!)
    SortedSet<Key> head = set.headSet(k);
    if (head.isEmpty()) return null;
    else return head.last();
}
 
开发者ID:wz12406,项目名称:accumulate,代码行数:12,代码来源:SET.java

示例11: testInappropraiteEntries

import java.util.SortedSet; //导入方法依赖的package包/类
/** Scan for accidentally commited files that get into product
 */
public void testInappropraiteEntries() throws Exception {
    SortedSet<Violation> violations = new TreeSet<Violation>();
    for (File f: org.netbeans.core.startup.Main.getModuleSystem().getModuleJars()) {
        // check JAR files only
        if (!f.getName().endsWith(".jar"))
            continue;
        
        if (!f.getName().endsWith("cssparser-0-9-4-fs.jar")) // #108644
            continue;
        
        JarFile jar = new JarFile(f);
        Enumeration<JarEntry> entries = jar.entries();
        JarEntry entry;
        BufferedImage img;
        while (entries.hasMoreElements()) {
            entry = entries.nextElement();
            if (entry.isDirectory())
                continue;
            
            if (entry.getName().endsWith("Thumbs.db")) {
                violations.add(new Violation(entry.getName(), jar.getName(), " should not be in module JAR"));
            }
            if (entry.getName().contains("nbproject/private")) {
                violations.add(new Violation(entry.getName(), jar.getName(), " should not be in module JAR"));
            }
        }
    }
    if (!violations.isEmpty()) {
        StringBuilder msg = new StringBuilder();
        msg.append("Some files does not belong to module JARs ("+violations.size()+"):\n");
        for (Violation viol: violations) {
            msg.append(viol).append('\n');
        }
        fail(msg.toString());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:ResourcesTest.java

示例12: create

import java.util.SortedSet; //导入方法依赖的package包/类
@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);
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:8,代码来源:SetGenerators.java

示例13: addProvidesList

import java.util.SortedSet; //导入方法依赖的package包/类
/**
 * Add the provides list for the module.
 *
 * @param tbody the content tree to which the directive will be added
 */
public void addProvidesList(Content tbody) {
    boolean altColor = true;
    SortedSet<TypeElement> implSet;
    Content description;
    for (Map.Entry<TypeElement, SortedSet<TypeElement>> entry : provides.entrySet()) {
        TypeElement srv = entry.getKey();
        if (!displayServiceDirective(srv, providesTrees)) {
            continue;
        }
        implSet = entry.getValue();
        Content srvLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, srv));
        HtmlTree thType = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, srvLinkContent);
        HtmlTree tdDesc = new HtmlTree(HtmlTag.TD);
        tdDesc.addStyle(HtmlStyle.colLast);
        if (display(providesTrees)) {
            description = providesTrees.get(srv);
            if (description != null) {
                tdDesc.addContent(description);
            }
        }
        addSummaryComment(srv, tdDesc);
        // Only display the implementation details in the "all" mode.
        if (moduleMode == ModuleMode.ALL && !implSet.isEmpty()) {
            tdDesc.addContent(new HtmlTree(HtmlTag.BR));
            tdDesc.addContent("(");
            HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, contents.implementation);
            tdDesc.addContent(implSpan);
            tdDesc.addContent(Contents.SPACE);
            String sep = "";
            for (TypeElement impl : implSet) {
                tdDesc.addContent(sep);
                tdDesc.addContent(getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, impl)));
                sep = ", ";
            }
            tdDesc.addContent(")");
        }
        HtmlTree tr = HtmlTree.TR(thType);
        tr.addContent(tdDesc);
        tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
        tbody.addContent(tr);
        altColor = !altColor;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:49,代码来源:ModuleWriterImpl.java

示例14: unsafeDelegateSortedSet

import java.util.SortedSet; //导入方法依赖的package包/类
static <E> ImmutableSortedSet<E> unsafeDelegateSortedSet(
    SortedSet<E> delegate, boolean isSubset) {
  return delegate.isEmpty()
      ? emptySet(delegate.comparator())
      : new RegularImmutableSortedSet<E>(delegate, isSubset);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:7,代码来源:ImmutableSortedSet.java

示例15: getEditLogManifest

import java.util.SortedSet; //导入方法依赖的package包/类
/**
 * Return a manifest of what finalized edit logs are available. All available
 * edit logs are returned starting from the transaction id passed. If
 * 'fromTxId' falls in the middle of a log, that log is returned as well.
 * 
 * @param fromTxId Starting transaction id to read the logs.
 * @return RemoteEditLogManifest object.
 */
public synchronized RemoteEditLogManifest getEditLogManifest(long fromTxId) {
  // Collect RemoteEditLogs available from each FileJournalManager
  List<RemoteEditLog> allLogs = Lists.newArrayList();
  for (JournalAndStream j : journals) {
    if (j.getManager() instanceof FileJournalManager) {
      FileJournalManager fjm = (FileJournalManager)j.getManager();
      try {
        allLogs.addAll(fjm.getRemoteEditLogs(fromTxId, false));
      } catch (Throwable t) {
        LOG.warn("Cannot list edit logs in " + fjm, t);
      }
    }
  }
  
  // Group logs by their starting txid
  ImmutableListMultimap<Long, RemoteEditLog> logsByStartTxId =
    Multimaps.index(allLogs, RemoteEditLog.GET_START_TXID);
  long curStartTxId = fromTxId;

  List<RemoteEditLog> logs = Lists.newArrayList();
  while (true) {
    ImmutableList<RemoteEditLog> logGroup = logsByStartTxId.get(curStartTxId);
    if (logGroup.isEmpty()) {
      // we have a gap in logs - for example because we recovered some old
      // storage directory with ancient logs. Clear out any logs we've
      // accumulated so far, and then skip to the next segment of logs
      // after the gap.
      SortedSet<Long> startTxIds = Sets.newTreeSet(logsByStartTxId.keySet());
      startTxIds = startTxIds.tailSet(curStartTxId);
      if (startTxIds.isEmpty()) {
        break;
      } else {
        if (LOG.isDebugEnabled()) {
          LOG.debug("Found gap in logs at " + curStartTxId + ": " +
              "not returning previous logs in manifest.");
        }
        logs.clear();
        curStartTxId = startTxIds.first();
        continue;
      }
    }

    // Find the one that extends the farthest forward
    RemoteEditLog bestLog = Collections.max(logGroup);
    logs.add(bestLog);
    // And then start looking from after that point
    curStartTxId = bestLog.getEndTxId() + 1;
  }
  RemoteEditLogManifest ret = new RemoteEditLogManifest(logs);
  
  if (LOG.isDebugEnabled()) {
    LOG.debug("Generated manifest for logs since " + fromTxId + ":"
        + ret);      
  }
  return ret;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:65,代码来源:JournalSet.java


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