MCPcopy Create free account
hub / github.com/antlr/codebuff / weigher

Method weigher

output/java_guava/1.4.13/CacheBuilder.java:492–506  ·  view source on GitHub ↗

Specifies the weigher to use in determining the weight of entries. Entry weight is taken into consideration by #maximumWeight(long) when determining which entries to evict, and use of this method requires a corresponding call to #maximumWeight(long) prior to calling #build. W

(Weigher<? super K1, ? super V1> weigher)

Source from the content-addressed store, hash-verified

490 */
491
492 @GwtIncompatible // To be supported
493 public <K1 extends K, V1 extends V> CacheBuilder<K1, V1> weigher(Weigher<? super K1, ? super V1> weigher) {
494 checkState(this.weigher == null);
495 if (strictParsing) {
496 checkState(this.maximumSize == UNSET_INT,
497 "weigher can not be combined with maximum size",
498 this.maximumSize);
499 }
500
501 // safely limiting the kinds of caches this can produce
502 @SuppressWarnings("unchecked")
503 CacheBuilder<K1, V1> me = (CacheBuilder<K1, V1>) this;
504 me.weigher = checkNotNull(weigher);
505 return me;
506 }
507
508 long getMaximumWeight() {
509 if (expireAfterWriteNanos == 0 || expireAfterAccessNanos == 0) {

Callers 1

recreateCacheBuilderMethod · 0.45

Calls 2

checkStateMethod · 0.45
checkNotNullMethod · 0.45

Tested by

no test coverage detected