Home / Function/ main() — netty Function Reference

main() — netty Function Reference

Architecture documentation for the main() function in HashCollisionTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  d3f29c04_06bf_6ce4_7812_c30e675e84d2["main()"]
  7f4340a8_96bd_ab16_3f24_b4cd9d2cac42["HashCollisionTest"]
  d3f29c04_06bf_6ce4_7812_c30e675e84d2 -->|defined in| 7f4340a8_96bd_ab16_3f24_b4cd9d2cac42
  b0a46d64_ef56_16c8_d893_46e179546484["addHttpHeaderNames()"]
  d3f29c04_06bf_6ce4_7812_c30e675e84d2 -->|calls| b0a46d64_ef56_16c8_d893_46e179546484
  c1c1b2a8_7e01_bbd3_e859_075672382f97["addHttpHeaderValues()"]
  d3f29c04_06bf_6ce4_7812_c30e675e84d2 -->|calls| c1c1b2a8_7e01_bbd3_e859_075672382f97
  1131f878_0f64_82e9_f57e_a06fb3aae797["addHttp2HeaderNames()"]
  d3f29c04_06bf_6ce4_7812_c30e675e84d2 -->|calls| 1131f878_0f64_82e9_f57e_a06fb3aae797
  48563d23_b563_7f71_5ec9_a6538fc1835e["addWordsFromFile()"]
  d3f29c04_06bf_6ce4_7812_c30e675e84d2 -->|calls| 48563d23_b563_7f71_5ec9_a6538fc1835e
  cd4b5b2a_2c94_0086_358c_df261e897a65["calculateDuplicates()"]
  d3f29c04_06bf_6ce4_7812_c30e675e84d2 -->|calls| cd4b5b2a_2c94_0086_358c_df261e897a65
  ed88f1e5_c2b8_3ec1_2ae5_1cff27cab91d["printResults()"]
  d3f29c04_06bf_6ce4_7812_c30e675e84d2 -->|calls| ed88f1e5_c2b8_3ec1_2ae5_1cff27cab91d
  style d3f29c04_06bf_6ce4_7812_c30e675e84d2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/HashCollisionTest.java lines 44–79

    public static void main(String[] args) throws IllegalAccessException, IOException, URISyntaxException {
        // Big initial size for when all name sources are pulled in.
        List<CharSequence> strings = new ArrayList<CharSequence>(350000);
        addHttpHeaderNames(strings);
        addHttpHeaderValues(strings);
        addHttp2HeaderNames(strings);
        addWordsFromFile(new File("/usr/share/dict/words"), strings);
        // More "english words" can be found here:
        // https://gist.github.com/Scottmitch/de2f03912778016ecee3c140478f07e0#file-englishwords-txt

        Map<Integer, List<CharSequence>> dups = calculateDuplicates(strings, new Function<CharSequence, Integer>() {
            @Override
            public Integer apply(CharSequence string) {
                int h = 0;
                for (int i = 0; i < string.length(); ++i) {
                    // masking with 0x1F reduces the number of overall bits that impact the hash code but makes the hash
                    // code the same regardless of character case (upper case or lower case hash is the same).
                    h = h * 31 + (string.charAt(i) & 0x1F);
                }
                return h;
            }
        });
        PrintStream writer = System.out;
        writer.println("==Old Duplicates==");
        printResults(writer, dups);

        dups = calculateDuplicates(strings, new Function<CharSequence, Integer>() {
            @Override
            public Integer apply(CharSequence string) {
                return PlatformDependent.hashCodeAscii(string);
            }
        });
        writer.println();
        writer.println("==New Duplicates==");
        printResults(writer, dups);
    }

Domain

Subdomains

Frequently Asked Questions

What does main() do?
main() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/HashCollisionTest.java.
Where is main() defined?
main() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/HashCollisionTest.java at line 44.
What does main() call?
main() calls 6 function(s): addHttp2HeaderNames, addHttpHeaderNames, addHttpHeaderValues, addWordsFromFile, calculateDuplicates, printResults.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free