All Downloads are FREE. Search and download functionalities are using the official Maven repository.

graphql.util.Interning Maven / Gradle / Ivy

There is a newer version: 230521-nf-execution
Show newest version
package graphql.util;

import com.google.common.collect.Interner;
import com.google.common.collect.Interners;
import graphql.Internal;
import org.jetbrains.annotations.NotNull;

/**
 * Interner allowing object-identity comparison of key entities like field names.  This is useful on hotspot
 * areas like the engine where we look up field names a lot inside maps, and those maps use object identity first
 * inside the key lookup code.
 */
@Internal
public class Interning {

    private Interning() {
    }

    private static final Interner INTERNER = Interners.newWeakInterner();

    public static @NotNull String intern(@NotNull String name) {
        return INTERNER.intern(name);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy