Package org.python.core.util

# Class StringCounter

java.lang.Object
org.python.core.util.StringCounter

public class StringCounter extends 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

Modifier and Type
Method
Description
`void`
`count(String s)`
Count this occurrence.
`Map<String,Integer>`
`top(int n)`
Report the top `n` counts.
`void`
`top(int n, PrintStream out)`
Report the top n counts.

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

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### StringCounter

public StringCounter()

## Method Details

### count

public void count(String s)
Count this occurrence.

Parameters:
  `s` - to count

### top

public Map<String,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, PrintStream out)
Report the top n counts.