Class StringCounter


  • public class StringCounter
    extends java.lang.Object
    Not for application use, this class may be used to count how many times a String occurs a point in the runtime. We use this to investigate optimisations of the handling of strings in the runtime, principally to avoid checks for byte-nature where that is already known.
    • Constructor Summary

      Constructors 
      Constructor Description
      StringCounter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void count​(java.lang.String s)
      Count this occurrence.
      java.util.Map<java.lang.String,​java.lang.Integer> top​(int n)
      Report the top n counts.
      void top​(int n, java.io.PrintStream out)
      Report the top n counts.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringCounter

        public StringCounter()
    • Method Detail

      • count

        public void count​(java.lang.String s)
        Count this occurrence.
        Parameters:
        s - to count
      • top

        public java.util.Map<java.lang.String,​java.lang.Integer> top​(int n)
        Report the top n counts.
        Parameters:
        n - number of counts to retrieve
        Returns:
        counts of the top n strings.
      • top

        public void top​(int n,
                        java.io.PrintStream out)
        Report the top n counts.