@@ -0,0 +1,2175 @@
+package com.carrotsearch.hppc.examples;%0A%0Aimport java.util.*;%0A%0Aimport org.junit.Test;%0A%0Aimport com.carrotsearch.hppc.IntIntOpenHashMap;%0Aimport com.carrotsearch.hppc.hash.IntMurmurHash;%0Aimport com.carrotsearch.junitbenchmarks.AbstractBenchmark;%0A%0Apublic class ForEach%0A%7B%0A    public void accessAnonymousClassFieldInForEach()%0A    %7B%0A        // %5B%5B%5Bstart:foreach-counting%5D%5D%5D%0A        // Create a map.%0A        final IntIntOpenHashMap map = new IntIntOpenHashMap();%0A        map.put(1, 2);%0A        map.put(2, 5);%0A        map.put(3, 10);%0A%0A        int count = map.forEach(new IntIntProcedure() %7B%0A           int count;%0A           public void apply(int key, int value)%0A           %7B%0A               if (value %3E= 5) count++;%0A           %7D%0A        %7D).count;%0A        System.out.println(%22There are %22 + count + %22 values %3E= 5%22);%0A        // %5B%5B%5Bend:foreach-counting%5D%5D%5D%0A    %7D%0A%0A    @Test%0A    public void characterCountingWithJcfSmarter()%0A    %7B%0A        final char %5B%5D CHARS = DATA;%0A        final Map%3CInteger, IntHolder%3E counts = new HashMap%3CInteger, IntHolder%3E();%0A        for (int i = 0; i %3C CHARS.length - 1; i++)%0A        %7B%0A            final int bigram = CHARS%5Bi%5D %3C%3C 16 %7C CHARS%5Bi+1%5D;%0A            final IntHolder currentCount = counts.get(bigram);%0A            if (currentCount == null)%0A            %7B%0A                counts.put(bigram, new IntHolder(1));%0A            %7D%0A            else%0A            %7B%0A                currentCount.value++;%0A            %7D%0A        %7D%0A    %7D%0A    %0A    @Test%0A    public void characterCountingWithJcfNaive()%0A    %7B%0A        final char %5B%5D CHARS = DATA;%0A        final Map%3CInteger, Integer%3E counts = new HashMap%3CInteger, Integer%3E();%0A        for (int i = 0; i %3C CHARS.length - 1; i++)%0A        %7B%0A            final int bigram = CHARS%5Bi%5D %3C%3C 16 %7C CHARS%5Bi+1%5D;%0A            final Integer currentCount = counts.get(bigram);%0A            if (currentCount == null)%0A            %7B%0A                counts.put(bigram, 1);%0A            %7D%0A            else%0A            %7B%0A                counts.put(bigram, currentCount + 1);%0A            %7D%0A        %7D%0A    %7D%0A%0A    private static final class IntHolder%0A    %7B%0A        int value;%0A%0A        IntHolder(int initial)%0A        %7B%0A            value = initial;%0A        %7D%0A    %7D%0A%7D%0A

Adding forEach example snippet.