Class UnitCache.CacheKey

All Implemented Interfaces:
Enclosing class:

static class UnitCache.CacheKey
extends Object
implements Comparable<UnitCache.CacheKey>
Units are cached by (quantity,symbol) combination. This class is used as keys to the cache and overrides the equals and hashcode methods to makes sure that two keys with the same quantity and symbol are considered equal.

This class also implements the comparable interface so that it is possible to sort units in the order of their symbols. If two symbols are equal the one with the lowes quantity id is sorted first.

  • Field Details

    • quantityId

      private final int quantityId
    • symbol

      private final String symbol
  • Constructor Details

    • CacheKey

      CacheKey​(int quantityId, String symbol)
  • Method Details