Class HashCodeCollider

java.lang.Object
org.apache.pekko.http.HashCodeCollider

public class HashCodeCollider extends Object
Helper that creates strings that all share the same hashCode == 0.

Adapted from MIT-licensed code by Andriy Plokhotnyuk at https://github.com/plokhotnyuk/jsoniter-scala/blob/26b5ecdd4f8c2ab7e97bd8106cefdda4c1e701ce/jsoniter-scala-benchmark/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/macros/HashCodeCollider.scala#L6.

  • Constructor Details

    • HashCodeCollider

      public HashCodeCollider()
  • Method Details

    • visibleChars

      public static scala.collection.immutable.IndexedSeq<Object> visibleChars()
    • asciiChars

      public static scala.collection.Iterator<Object> asciiChars()
    • asciiCharsAndHash

      public static scala.collection.Iterator<scala.Tuple2<Object,Object>> asciiCharsAndHash(int previousHash)
    • zeroHashCodeIterator

      public static scala.collection.Iterator<String> zeroHashCodeIterator()
      Creates an iterator of Strings that all have hashCode == 0