htsjdk.samtools.util.Histogram.comparator()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(167)

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

Histogram.comparator介绍

[英]Returns the comparator used to order the keys in this histogram, or null if this histogram uses the Comparable of its keys.
[中]返回用于在此直方图中对关键帧进行排序的比较器,如果此直方图使用其关键帧的可比性,则返回null。

代码示例

代码示例来源:origin: samtools/htsjdk

final java.util.Set<HKEY> keys = new TreeSet<HKEY>(nonEmptyHistograms.get(0).comparator());
for (final Histogram<HKEY> histo : nonEmptyHistograms) {
  if (histo != null) keys.addAll(histo.keySet());

代码示例来源:origin: com.github.samtools/htsjdk

final java.util.Set<HKEY> keys = new TreeSet<HKEY>(nonEmptyHistograms.get(0).comparator());
for (final Histogram<HKEY> histo : nonEmptyHistograms) {
  if (histo != null) keys.addAll(histo.keySet());

代码示例来源:origin: org.seqdoop/htsjdk

final java.util.Set<HKEY> keys = new TreeSet<HKEY>(nonEmptyHistograms.get(0).comparator());
for (final Histogram<HKEY> histo : nonEmptyHistograms) {
  if (histo != null) keys.addAll(histo.keySet());

代码示例来源:origin: samtools/htsjdk

@Test
public void testComparator() {
  final int[] is = {4,4,5,5,5};
  final Histogram<Integer> histo1 = new Histogram<>();
  for (final int i : is) histo1.increment(i);
  Assert.assertNull(histo1.comparator());
  final Histogram<Integer> histo2 = new Histogram<>(Comparator.comparingInt(Integer::intValue));
  Comparator<Integer> comp = (Comparator<Integer>) histo2.comparator();
  Assert.assertNotNull(comp);
  Assert.assertEquals(comp.compare(4,5), -1);
}

相关文章