Interface LongBag

    • Method Detail

      • sizeDistinct

        int sizeDistinct()
        The size of the Bag when counting only distinct elements.
      • selectByOccurrences

        LongBag selectByOccurrences​(IntPredicate predicate)
        Returns all elements of the bag that have a number of occurrences that satisfy the predicate.
        Since:
        8.0
      • selectDuplicates

        default LongBag selectDuplicates()
        Returns all elements of the bag that have more than one occurrence.
        Since:
        9.2
      • selectUnique

        LongSet selectUnique()
        Returns all elements of the bag that have exactly one occurrence.
        Since:
        9.2
      • topOccurrences

        ListIterable<LongIntPair> topOccurrences​(int count)
        Returns the count most frequently occurring items. In the event of a tie, all of the items with the number of occurrences that match the occurrences of the last item will be returned.
        Since:
        8.0
      • bottomOccurrences

        ListIterable<LongIntPair> bottomOccurrences​(int count)
        Returns the count least frequently occurring items. In the event of a tie, all of the items with the number of occurrences that match the occurrences of the last item will be returned.
        Since:
        8.0
      • occurrencesOf

        int occurrencesOf​(long item)
        The occurrences of a distinct item in the bag.
      • forEachWithOccurrences

        void forEachWithOccurrences​(LongIntProcedure procedure)
        For each distinct item, with the number of occurrences, execute the specified procedure.
      • select

        LongBag select​(LongPredicate predicate)
        Description copied from interface: LongIterable
        Returns a new LongIterable with all of the elements in the LongIterable that return true for the specified predicate.
        Specified by:
        select in interface LongIterable
      • reject

        LongBag reject​(LongPredicate predicate)
        Description copied from interface: LongIterable
        Returns a new LongIterable with all of the elements in the LongIterable that return false for the specified predicate.
        Specified by:
        reject in interface LongIterable
      • collect

        <V> Bag<V> collect​(LongToObjectFunction<? extends V> function)
        Description copied from interface: LongIterable
        Returns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.
        Specified by:
        collect in interface LongIterable
      • equals

        boolean equals​(java.lang.Object o)
        Follows the same general contract as Bag.equals(Object).
        Overrides:
        equals in class java.lang.Object
      • hashCode

        int hashCode()
        Follows the same general contract as Bag.hashCode().
        Overrides:
        hashCode in class java.lang.Object
      • toImmutable

        ImmutableLongBag toImmutable()
        Returns an immutable copy of this bag. If the bag is immutable, it returns itself.
      • toStringOfItemToCount

        default java.lang.String toStringOfItemToCount()
        Since:
        9.2