• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SampleElements类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.common.collect.testing.SampleElements的典型用法代码示例。如果您正苦于以下问题:Java SampleElements类的具体用法?Java SampleElements怎么用?Java SampleElements使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SampleElements类属于com.google.common.collect.testing包,在下文中一共展示了SampleElements类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: samples

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
@Override
public SampleElements<Map.Entry<String, String>> samples() {
  return new SampleElements<Map.Entry<String, String>>(
      Helpers.mapEntry("one", "January"),
      Helpers.mapEntry("two", "February"),
      Helpers.mapEntry("three", "March"),
      Helpers.mapEntry("four", "April"),
      Helpers.mapEntry("five", "May"));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:10,代码来源:TestStringBiMapGenerator.java


示例2: samples

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
@Override
public SampleElements<Entry<String, Integer>> samples() {
  return new SampleElements<Entry<String, Integer>>(
      mapEntry("foo", 5),
      mapEntry("bar", 3),
      mapEntry("baz", 17),
      mapEntry("quux", 1),
      mapEntry("toaster", -2));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:10,代码来源:SortedMapGenerators.java


示例3: samples

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
@Override
public SampleElements<Entry<String, Integer>> samples() {
  return new SampleElements<>(
      mapEntry("foo", 5),
      mapEntry("bar", 3),
      mapEntry("baz", 17),
      mapEntry("quux", 1),
      mapEntry("toaster", -2));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:10,代码来源:MapGenerators.java


示例4: BiMapValueSetGenerator

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
public BiMapValueSetGenerator(
    OneSizeTestContainerGenerator<BiMap<K, V>, Entry<K, V>> mapGenerator) {
  this.mapGenerator = mapGenerator;
  final SampleElements<Map.Entry<K, V>> mapSamples = this.mapGenerator.samples();
  this.samples =
      new SampleElements<V>(
          mapSamples.e0().getValue(),
          mapSamples.e1().getValue(),
          mapSamples.e2().getValue(),
          mapSamples.e3().getValue(),
          mapSamples.e4().getValue());
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:13,代码来源:DerivedGoogleCollectionGenerators.java


示例5: samples

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
@Override
public SampleElements<Entry<K, Collection<V>>> samples() {
  SampleElements<K> sampleKeys =
      ((TestMultimapGenerator<K, V, M>) multimapGenerator.getInnerGenerator()).sampleKeys();
  SampleElements<V> sampleValues =
      ((TestMultimapGenerator<K, V, M>) multimapGenerator.getInnerGenerator()).sampleValues();
  return new SampleElements<Entry<K, Collection<V>>>(
      mapEntry(sampleKeys.e0(), createCollection(sampleValues.e0())),
      mapEntry(sampleKeys.e1(), createCollection(sampleValues.e1())),
      mapEntry(sampleKeys.e2(), createCollection(sampleValues.e2())),
      mapEntry(sampleKeys.e3(), createCollection(sampleValues.e3())),
      mapEntry(sampleKeys.e4(), createCollection(sampleValues.e4())));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:14,代码来源:MultimapTestSuiteBuilder.java


示例6: testUnhashableMixedValues

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
public void testUnhashableMixedValues() {
  SampleElements<UnhashableObject> unhashables = new Unhashables();
  Multimap<Integer, Object> multimap = ImmutableMultimap.<Integer, Object>of(
      0, unhashables.e0(), 2, "hey you", 0, unhashables.e1());
  assertEquals(2, multimap.get(0).size());
  assertTrue(multimap.get(0).contains(unhashables.e0()));
  assertTrue(multimap.get(0).contains(unhashables.e1()));
  assertTrue(multimap.get(2).contains("hey you"));
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:10,代码来源:ImmutableMultimapTest.java


示例7: samples

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
@Override
public SampleElements<Cell<String, Integer, Character>> samples() {
  return new SampleElements<Cell<String, Integer, Character>>(
      Tables.immutableCell("bar", 1, 'a'),
      Tables.immutableCell("bar", 2, 'b'),
      Tables.immutableCell("foo", 3, 'c'),
      Tables.immutableCell("bar", 1, 'b'),
      Tables.immutableCell("cat", 2, 'b'));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:10,代码来源:TableCollectionTest.java


示例8: samples

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
@Override
public SampleElements<Entry<String, String>> samples() {
  return new SampleElements<Entry<String, String>>(
      mapEntry("one", "january"),
      mapEntry("two", "february"),
      mapEntry("three", "march"),
      mapEntry("four", "april"),
      mapEntry("five", "may"));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:10,代码来源:MultimapsCollectionTest.java


示例9: samples

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
@Override
public SampleElements<Entry<Class, Impl>> samples() {
  return new SampleElements<Entry<Class, Impl>>(
      immutableEntry((Class) One.class, new Impl(1)),
      immutableEntry((Class) Two.class, new Impl(2)),
      immutableEntry((Class) Three.class, new Impl(3)),
      immutableEntry((Class) Four.class, new Impl(4)),
      immutableEntry((Class) Five.class, new Impl(5)));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:10,代码来源:ImmutableClassToInstanceMapTest.java


示例10: samples

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
@Override
public SampleElements<Entry<Country, String>> samples() {
  return new SampleElements<Entry<Country, String>>(
      Maps.immutableEntry(Country.CANADA, "DOLLAR"),
      Maps.immutableEntry(Country.CHILE, "PESO"),
      Maps.immutableEntry(Country.UK, "POUND"),
      Maps.immutableEntry(Country.JAPAN, "YEN"),
      Maps.immutableEntry(Country.SWITZERLAND, "FRANC"));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:10,代码来源:EnumHashBiMapTest.java


示例11: samples

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
@Override
public SampleElements<Entry<Country, Currency>> samples() {
  return new SampleElements<Entry<Country, Currency>>(
      Helpers.mapEntry(Country.CANADA, Currency.DOLLAR),
      Helpers.mapEntry(Country.CHILE, Currency.PESO),
      Helpers.mapEntry(Country.UK, Currency.POUND),
      Helpers.mapEntry(Country.JAPAN, Currency.YEN),
      Helpers.mapEntry(Country.SWITZERLAND, Currency.FRANC));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:10,代码来源:EnumBiMapTest.java


示例12: samples

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
@Override
public SampleElements<BigInteger> samples() {
  return new SampleElements<BigInteger>(
      BigInteger.valueOf(1),
      BigInteger.valueOf(4),
      BigInteger.valueOf(3),
      BigInteger.valueOf(2),
      BigInteger.valueOf(5));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:10,代码来源:ImmutableRangeSetTest.java


示例13: testUnhashableSingletonValue

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
public void testUnhashableSingletonValue() {
  SampleElements<UnhashableObject> unhashables = new Unhashables();
  Multimap<Integer, UnhashableObject> multimap = ImmutableMultimap.of(
      0, unhashables.e0());
  assertEquals(1, multimap.get(0).size());
  assertTrue(multimap.get(0).contains(unhashables.e0()));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:8,代码来源:ImmutableMultimapTest.java


示例14: samples

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
@Override
public SampleElements<Entry<TypeToken, Object>> samples() {
  return new SampleElements<Entry<TypeToken, Object>>(
      entry(TypeToken.of(Integer.class), 0),
      entry(TypeToken.of(Number.class), 1),
      entry(new TypeToken<ImmutableList<Integer>>() {}, ImmutableList.of(2)),
      entry(new TypeToken<int[]>() {}, new int[] {3}),
      entry(new TypeToken<Iterable<?>>() {}, ImmutableList.of("4")));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:10,代码来源:ImmutableTypeToInstanceMapTest.java


示例15: samples

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
@Override
public SampleElements<AnEnum> samples() {
  return new Enums();
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:5,代码来源:TestEnumMultisetGenerator.java


示例16: sampleKeys

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
@Override
public SampleElements<String> sampleKeys() {
  return new SampleElements<String>("one", "two", "three", "four", "five");
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:5,代码来源:TestStringListMultimapGenerator.java


示例17: sampleValues

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
@Override
public SampleElements<String> sampleValues() {
  return new SampleElements<String>("January", "February", "March", "April", "May");
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:5,代码来源:TestStringListMultimapGenerator.java


示例18: samples

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
@Override
public SampleElements<E> samples() {
  return gen.samples();
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:5,代码来源:MultisetTestSuiteBuilder.java


示例19: samples

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
@Override
public SampleElements<String> samples() {
  return new Strings();
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:5,代码来源:TestStringMultisetGenerator.java


示例20: createSubMultisetSuite

import com.google.common.collect.testing.SampleElements; //导入依赖的package包/类
private TestSuite createSubMultisetSuite(
    SortedMultisetTestSuiteBuilder<E> parentBuilder, final Bound from, final Bound to) {
  final TestMultisetGenerator<E> delegate =
      (TestMultisetGenerator<E>) parentBuilder.getSubjectGenerator();

  Set<Feature<?>> features = new HashSet<Feature<?>>();
  features.add(NoRecurse.SUBMULTISET);
  features.add(RESTRICTS_ELEMENTS);
  features.addAll(parentBuilder.getFeatures());

  if (!features.remove(SERIALIZABLE_INCLUDING_VIEWS)) {
    features.remove(SERIALIZABLE);
  }

  SortedMultiset<E> emptyMultiset = (SortedMultiset<E>) delegate.create();
  final Comparator<? super E> comparator = emptyMultiset.comparator();
  SampleElements<E> samples = delegate.samples();
  @SuppressWarnings("unchecked")
  List<E> samplesList =
      Arrays.asList(samples.e0(), samples.e1(), samples.e2(), samples.e3(), samples.e4());

  Collections.sort(samplesList, comparator);
  final E firstInclusive = samplesList.get(0);
  final E lastInclusive = samplesList.get(samplesList.size() - 1);

  return SortedMultisetTestSuiteBuilder.using(
          new ForwardingTestMultisetGenerator<E>(delegate) {
            @Override
            public SortedMultiset<E> create(Object... entries) {
              @SuppressWarnings("unchecked")
              // we dangerously assume E is a string
              List<E> extremeValues = (List) getExtremeValues();
              @SuppressWarnings("unchecked")
              // map generators must past entry objects
              List<E> normalValues = (List) Arrays.asList(entries);

              // prepare extreme values to be filtered out of view
              Collections.sort(extremeValues, comparator);
              E firstExclusive = extremeValues.get(1);
              E lastExclusive = extremeValues.get(2);
              if (from == Bound.NO_BOUND) {
                extremeValues.remove(0);
                extremeValues.remove(0);
              }
              if (to == Bound.NO_BOUND) {
                extremeValues.remove(extremeValues.size() - 1);
                extremeValues.remove(extremeValues.size() - 1);
              }

              // the regular values should be visible after filtering
              List<E> allEntries = new ArrayList<E>();
              allEntries.addAll(extremeValues);
              allEntries.addAll(normalValues);
              SortedMultiset<E> multiset =
                  (SortedMultiset<E>) delegate.create(allEntries.toArray());

              // call the smallest subMap overload that filters out the extreme
              // values
              if (from == Bound.INCLUSIVE) {
                multiset = multiset.tailMultiset(firstInclusive, BoundType.CLOSED);
              } else if (from == Bound.EXCLUSIVE) {
                multiset = multiset.tailMultiset(firstExclusive, BoundType.OPEN);
              }

              if (to == Bound.INCLUSIVE) {
                multiset = multiset.headMultiset(lastInclusive, BoundType.CLOSED);
              } else if (to == Bound.EXCLUSIVE) {
                multiset = multiset.headMultiset(lastExclusive, BoundType.OPEN);
              }

              return multiset;
            }
          })
      .named(parentBuilder.getName() + " subMultiset " + from + "-" + to)
      .withFeatures(features)
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:79,代码来源:SortedMultisetTestSuiteBuilder.java



注:本文中的com.google.common.collect.testing.SampleElements类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FloatDocValuesField类代码示例发布时间:2022-05-22
下一篇:
Java HibernateCallback类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap