/************************ first/last **************************/ public static <T> T getFirst(Collection<T> collection) { if (CollectionUtils.isEmpty(collection)) { return null; } for (T t : collection) { return t; } return null; }
public static <T> boolean notEmpty(Collection<T> collection) { return !isEmpty(collection); }
/************************ first/last **************************/ public static <T> T getFirst(Collection<T> collection) { if (CollectionUtils.isEmpty(collection)) { return null; } for (T t : collection) { return t; } return null; }
public static <T> boolean notEmpty(Collection<T> collection) { return !isEmpty(collection); }
/** * @param list any list * @return -1 if list is empty, otherwise the max index */ public static int getLastIndex(List<?> list){ if(isEmpty(list)){ return -1; } return list.size() - 1; }
/** * @param list any list * @return -1 if list is empty, otherwise the max index */ public static int getLastIndex(List<?> list){ if(isEmpty(list)){ return -1; } return list.size() - 1; }
public static <T> T getLast(List<T> list) { if (isEmpty(list)) { return null; } return list.get(list.size() - 1); } }
public static <T> T getLast(List<T> list) { if (isEmpty(list)) { return null; } return list.get(list.size() - 1); }
public TokenizerNode getLastChild() { if (CollectionUtils.isEmpty(children)) { return null; } return CollectionUtils.getLast(children); }
public TokenizerNode getLastChild() { if (CollectionUtils.isEmpty(children)) { return null; } return CollectionUtils.getLast(children); }
public boolean isLeaf() { return CollectionUtils.isEmpty(children) && hasOccurrences(); }
public boolean isLeaf() { return CollectionUtils.isEmpty(children) && hasOccurrences(); }
/** * Create a {@link RowMutations} with the specified mutations. * @param mutations the mutations to send * @return RowMutations * @throws IOException if any row in mutations is different to another */ public static RowMutations of(List<? extends Mutation> mutations) throws IOException { if (CollectionUtils.isEmpty(mutations)) { throw new IllegalArgumentException("Can't instantiate a RowMutations by empty list"); } return new RowMutations(mutations.get(0).getRow(), mutations.size()) .add(mutations); }
public SingleSampleIndexVariantDBIterator(Table table, List<Region> regions, Integer studyId, String sample, List<String> gts, SampleIndexDBAdaptor dbAdaptor) { if (CollectionUtils.isEmpty(regions)) { // If no regions are defined, get a list of one null element to initialize the stream. regions = Collections.singletonList(null); } else { regions = VariantQueryUtils.mergeRegions(regions); } Iterator<Iterator<Variant>> iterators = regions.stream() .map(region -> { // One scan per region Scan scan = dbAdaptor.parse(region, studyId, sample, gts, false); SampleIndexConverter converter = new SampleIndexConverter(region); try { ResultScanner scanner = table.getScanner(scan); addCloseable(scanner); Iterator<Result> resultIterator = scanner.iterator(); Iterator<Iterator<Variant>> transform = Iterators.transform(resultIterator, result -> converter.convert(result).iterator()); return Iterators.concat(transform); } catch (IOException e) { throw VariantQueryException.internalException(e); } }).iterator(); iterator = Iterators.concat(iterators); }
FSWALEntry(final long sequence, final WALKey key, final WALEdit edit, final HTableDescriptor htd, final HRegionInfo hri, final boolean inMemstore) { super(key, edit); this.inMemstore = inMemstore; this.htd = htd; this.hri = hri; this.sequence = sequence; if (inMemstore) { // construct familyNames here to reduce the work of log sinker. ArrayList<Cell> cells = this.getEdit().getCells(); if (CollectionUtils.isEmpty(cells)) { this.familyNames = Collections.<byte[]> emptySet(); } else { Set<byte[]> familySet = Sets.newTreeSet(Bytes.BYTES_COMPARATOR); for (Cell cell : cells) { if (!CellUtil.matchingFamily(cell, WALEdit.METAFAMILY)) { familySet.add(CellUtil.cloneFamily(cell)); } } this.familyNames = Collections.unmodifiableSet(familySet); } } else { this.familyNames = Collections.<byte[]> emptySet(); } }
if (CollectionUtils.isEmpty(children)) { if (thisNodeDepthPlusLength < keyLength) {// ran out of bytes resultHolder.set(TokenizerRowSearchPosition.NO_MATCH, null);
if (CollectionUtils.isEmpty(children)) { if (thisNodeDepthPlusLength < keyLength) {// ran out of bytes resultHolder.set(TokenizerRowSearchPosition.NO_MATCH, null);
public long count(List<Region> regions, String study, String sample, List<String> gts) { List<Region> regionsList; if (CollectionUtils.isEmpty(regions)) { if (CollectionUtils.isEmpty(gts)) { StudyConfiguration sc = scm.getStudyConfiguration(studyId, RO_CACHED_OPTIONS).first(); gts = sc.getAttributes().getAsStringList(VariantStorageEngine.Options.LOADED_GENOTYPES.key());