當前位置: 首頁>>代碼示例>>Java>>正文


Java Interners類代碼示例

本文整理匯總了Java中com.google.common.collect.Interners的典型用法代碼示例。如果您正苦於以下問題:Java Interners類的具體用法?Java Interners怎麽用?Java Interners使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Interners類屬於com.google.common.collect包,在下文中一共展示了Interners類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: makeInterner

import com.google.common.collect.Interners; //導入依賴的package包/類
public static Interner<String> makeInterner ( final String specificPropertyName, final String defaultType )
{
    final String type = System.getProperty ( specificPropertyName, System.getProperty ( "org.eclipse.scada.defaultStringInterner", defaultType ) );
    if ( "weak".equals ( type ) )
    {
        return new NullSafeInterner ( Interners.<String> newWeakInterner () );
    }
    else if ( "strong".equals ( type ) )
    {
        return new NullSafeInterner ( Interners.<String> newStrongInterner () );
    }
    else if ( "java".equals ( type ) )
    {
        return new JavaStringInterner ();
    }
    else
    {
        return makeNoOpInterner ();
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:21,代碼來源:InternerHelper.java

示例2: DoubleClickMetadata

import com.google.common.collect.Interners; //導入依賴的package包/類
/**
 * Creates the DoubleClickMetadata object.
 *
 * @param transport How to read the many files providing metadata information.
 *     Typically you will use one of the provided implementations,
 *     {@link URLConnectionTransport} or {@link ResourceTransport}
 */
@Inject
public DoubleClickMetadata(Transport transport) {
  Pattern ssvp = Pattern.compile("(\\d+)\\s+(.*)");
  Pattern csvp = Pattern.compile("(\\d+),(.*)");

  Interner<String> interner = Interners.<String>newStrongInterner();
  vendors = load(interner, transport, ssvp, ADX_DICT + "vendors.txt");
  gdnVendors = load(interner, transport, ssvp, ADX_DICT + "gdn-vendors.txt");
  HashMap<Integer, String> cats = new HashMap<>();
  cats.putAll(adSensitiveCategories = load(
      interner, transport, ssvp, ADX_DICT + "ad-sensitive-categories.txt"));
  cats.putAll(adProductCategories = load(
      interner, transport, ssvp, ADX_DICT + "ad-product-categories.txt"));
  cats.putAll(adRestrictedCategories = load(
      interner, transport, ssvp, ADX_DICT + "ad-restricted-categories.txt"));
  allAdCategories = ImmutableMap.copyOf(cats);
  agencies = load(interner, transport, ssvp, ADX_DICT + "agencies.txt");
  HashMap<Integer, String> attrs = new HashMap<>();
  attrs.putAll(pubExcCreativeAttributes =
      load(interner, transport, ssvp, ADX_DICT + "publisher-excludable-creative-attributes.txt"));
  attrs.putAll(buyDecCreativeAttributes =
      load(interner, transport, ssvp, ADX_DICT + "buyer-declarable-creative-attributes.txt"));
  allCreativeAttributes = ImmutableMap.copyOf(attrs);
  creativeStatusCodes = load(interner, transport, ssvp, ADX_DICT + "creative-status-codes.txt");
  sellerNetworks = load(interner, transport, ssvp, ADX_DICT + "seller-network-ids.txt");
  siteLists = load(interner, transport, ssvp, ADX_DICT + "site-lists.txt");
  contentLabels = load(interner, transport, ssvp, ADX_DICT + "content-labels.txt");
  publisherVerticals = load(interner, transport, ssvp, ADX_DICT + "publisher-verticals.txt");
  mobileCarriers = load(interner, transport, CSVParser.csvParser(), csvp,
      ADX_DICT + "mobile-carriers.csv");
  geoTargetsByCriteriaId = loadGeoTargets(interner, transport, ADX_DICT + "geo-table.csv");
  HashMap<GeoTarget.CanonicalKey, GeoTarget> byKey = new HashMap<>();
  for (GeoTarget target : geoTargetsByCriteriaId.values()) {
    byKey.put(target.key(), target);
  }
  geoTargetsByCanonicalKey = ImmutableMap.copyOf(byKey);
  dmaRegions = loadCitiesDMARegions(interner, ADX_DICT + "cities-dma-regions.csv");
  countryCodes = loadCountryCodes(interner, ADX_DICT + "countries.txt");
}
 
開發者ID:google,項目名稱:openrtb-doubleclick,代碼行數:47,代碼來源:DoubleClickMetadata.java

示例3: findInterner

import com.google.common.collect.Interners; //導入依賴的package包/類
private Interner<String> findInterner() {
    Player player = gameManager.getPlayerManager().getPlayer(playerId);
    Interner<String> interner;
    if (player == null) {
        interner = Interners.newWeakInterner();
    } else {
        interner = player.getInterner();
    }
    return interner;
}
 
開發者ID:chriskearney,項目名稱:creeper,代碼行數:11,代碼來源:PlayerManagement.java

示例4: SimpleFileProviderBackend

import com.google.common.collect.Interners; //導入依賴的package包/類
public SimpleFileProviderBackend(Configuration conf, Path resourcePath) throws IOException {
  this.resourcePath = resourcePath;
  this.fileSystem = resourcePath.getFileSystem(conf);
  this.groupRolePrivilegeTable = HashBasedTable.create();
  this.conf = conf;
  this.configErrors = Lists.newArrayList();
  this.configWarnings = Lists.newArrayList();
  this.validators = ImmutableList.of();
  this.allowPerDatabaseSection = true;
  this.initialized = false;
  this.stringInterner = Interners.newWeakInterner();
}
 
開發者ID:apache,項目名稱:incubator-sentry,代碼行數:13,代碼來源:SimpleFileProviderBackend.java

示例5: StringInterner

import com.google.common.collect.Interners; //導入依賴的package包/類
public StringInterner() {
    this.interner = Interners.newWeakInterner();
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:4,代碼來源:StringInterner.java

示例6: XFactoryEfficientImpl

import com.google.common.collect.Interners; //導入依賴的package包/類
public XFactoryEfficientImpl() {
    super();
    // Use an weak references as this factory may stay around in the XFactoryRegistry for a long time
    interner = Interners.newWeakInterner();
}
 
開發者ID:raffaeleconforti,項目名稱:ResearchCode,代碼行數:6,代碼來源:XFactoryEfficientImpl.java

示例7: XFactoryMemoryImpl

import com.google.common.collect.Interners; //導入依賴的package包/類
public XFactoryMemoryImpl() {
    super();
    // Use an weak references as this factory may stay around in the XFactoryRegistry for a long time
    interner = Interners.newWeakInterner();
}
 
開發者ID:raffaeleconforti,項目名稱:ResearchCode,代碼行數:6,代碼來源:XFactoryMemoryImpl.java

示例8: XFactoryNaiveImpl

import com.google.common.collect.Interners; //導入依賴的package包/類
public XFactoryNaiveImpl() {
	super();
	// Use an weak references as this factory may stay around in the XFactoryRegistry for a long time 
	interner = Interners.newWeakInterner();
}
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:6,代碼來源:XFactoryNaiveImpl.java

示例9: WeakMapStringPool

import com.google.common.collect.Interners; //導入依賴的package包/類
public WeakMapStringPool(StringPoolPolicy heuristic) {
  super(heuristic);
  this.interner = Interners.newWeakInterner();
}
 
開發者ID:torodb,項目名稱:mongowp,代碼行數:5,代碼來源:WeakMapStringPool.java

示例10: newWeakInterner

import com.google.common.collect.Interners; //導入依賴的package包/類
public static <T> Interner<T> newWeakInterner() {
  return setConcurrencyLevel(Interners.newBuilder().weak()).build();
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:4,代碼來源:BlazeInterners.java

示例11: newStrongInterner

import com.google.common.collect.Interners; //導入依賴的package包/類
public static <T> Interner<T> newStrongInterner() {
  return setConcurrencyLevel(Interners.newBuilder().strong()).build();
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:4,代碼來源:BlazeInterners.java


注:本文中的com.google.common.collect.Interners類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。