org.apache.storm.starter.tools

## Class Rankings

- java.lang.Object
- - org.apache.storm.starter.tools.Rankings

- All Implemented Interfaces:
    Serializable

      public class Rankings
      extends Object
      implements Serializable

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Rankings()`
    `Rankings(int topN)`
    `Rankings(Rankings other)` Copy constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Rankings` | `copy()` Creates a (defensive) copy of itself.
    `List<Rankable>` | `getRankings()` The returned defensive copy is only “somewhat” defensive.
    `int` | `maxSize()` Get max size.
    `void` | `pruneZeroCounts()` Removes ranking entries that have a count of zero.
    `int` | `size()` Get size.
    `String` | `toString()`
    `void` | `updateWith(Rankable r)`
    `void` | `updateWith(Rankings other)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Rankings

          public Rankings()

    - #### Rankings

          public Rankings(int topN)

    - #### Rankings

          public Rankings(Rankings other)

      Copy constructor.

  - ### Method Detail

    - #### maxSize

          public int maxSize()

      Get max size.

      Returns:
        the maximum possible number (size) of ranked objects this instance can hold

    - #### size

          public int size()

      Get size.

      Returns:
        the number (size) of ranked objects this instance is currently holding

    - #### getRankings

          public List<Rankable> getRankings()

      The returned defensive copy is only “somewhat” defensive. We do, for instance, return a defensive copy of the enclosing List instance, and we do try to defensively copy any contained Rankable objects, too. However, the contract of `Rankable.copy()` does not guarantee that any Object’s embedded within a Rankable will be defensively copied, too.

      Returns:
        a somewhat defensive copy of ranked items

    - #### updateWith

          public void updateWith(Rankings other)

    - #### updateWith

          public void updateWith(Rankable r)

    - #### pruneZeroCounts

          public void pruneZeroCounts()

      Removes ranking entries that have a count of zero.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### copy

          public Rankings copy()

      Creates a (defensive) copy of itself.

Copyright © 2021 The Apache Software Foundation. All rights reserved.