Home / Function/ randomOperations() — netty Function Reference

randomOperations() — netty Function Reference

Architecture documentation for the randomOperations() function in LongLongHashMapTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  cf610cb3_31fe_6d9e_bbc7_4c4a148c7fea["randomOperations()"]
  be777c84_c118_10ce_0f6a_336f06b7436d["LongLongHashMapTest"]
  cf610cb3_31fe_6d9e_bbc7_4c4a148c7fea -->|defined in| be777c84_c118_10ce_0f6a_336f06b7436d
  style cf610cb3_31fe_6d9e_bbc7_4c4a148c7fea fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/test/java/io/netty/util/internal/LongLongHashMapTest.java lines 60–85

    @Test
    public void randomOperations() {
        int operations = 6000;
        java.util.concurrent.ThreadLocalRandom tlr = ThreadLocalRandom.current();
        Map<Long, Long> expected = new HashMap<Long, Long>();
        LongLongHashMap actual = new LongLongHashMap(-1);
        OfLong itr = tlr.longs(0, operations).limit(operations * 50).iterator();
        while (itr.hasNext()) {
            long value = itr.nextLong();
            if (expected.containsKey(value)) {
                assertThat(actual.get(value)).isEqualTo(expected.get(value));
                if (tlr.nextBoolean()) {
                    actual.remove(value);
                    expected.remove(value);
                    assertThat(actual.get(value)).isEqualTo(-1);
                } else {
                    long v = expected.get(value);
                    assertThat(actual.put(value, -v)).isEqualTo(expected.put(value, -v));
                }
            } else {
                assertThat(actual.get(value)).isEqualTo(-1);
                assertThat(actual.put(value, value)).isEqualTo(-1);
                expected.put(value, value);
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does randomOperations() do?
randomOperations() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/internal/LongLongHashMapTest.java.
Where is randomOperations() defined?
randomOperations() is defined in common/src/test/java/io/netty/util/internal/LongLongHashMapTest.java at line 60.

Analyze Your Own Codebase

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

Try Supermodel Free