private static void clean(MappedByteBuffer mmap) {
            if ((mmap == null) || !mmap.isDirect()) return;

            try {
                Class<?> unsafeClass;
                try {
                    unsafeClass = Class.forName("sun.misc.Unsafe");
                } catch (Exception ex) {
                    // jdk.internal.misc.Unsafe doesn't yet have an invokeCleaner() method,
                    // but that method should be added if sun.misc.Unsafe is removed.
                    unsafeClass = Class.forName("jdk.internal.misc.Unsafe");
                }
                Method clean = unsafeClass.getMethod("invokeCleaner", ByteBuffer.class);
                clean.setAccessible(true);
                Field theUnsafeField = unsafeClass.getDeclaredField("theUnsafe");
                theUnsafeField.setAccessible(true);
                Object theUnsafe = theUnsafeField.get(null);
                clean.invoke(theUnsafe, mmap);
            } catch (Exception e) {
                throw new IllegalArgumentException("Failed unmapping ", e);
            }
        }
Returns a new iterator to the given state.
@param state the state to create the iterator from.
fsa/src/main/java/com/yahoo/fsa/FSA.java