Example usage for org.apache.commons.collections.bag TreeBag add

List of usage examples for org.apache.commons.collections.bag TreeBag add

Introduction

In this page you can find the example usage for org.apache.commons.collections.bag TreeBag add.

Prototype

public boolean add(Object object, int nCopies) 

Source Link

Document

Adds a new element to the bag, incrementing its count in the map.

Usage

From source file:org.sonar.api.utils.DeprecatedKeyValueFormatTest.java

@Test
public void formatBag() {
    TreeBag bag = new TreeBag();
    bag.add("hello", 1);
    bag.add("key", 3);
    assertThat(KeyValueFormat.format(bag), is("hello=1;key=3"));
}

From source file:org.sonar.api.utils.DeprecatedKeyValueFormatTest.java

@Test
public void formatBagWithVariationHack() {
    TreeBag bag = new TreeBag();
    bag.add("hello", 1);
    bag.add("key", 3);
    assertThat(KeyValueFormat.format(bag, -1), is("hello=0;key=2"));
}

From source file:org.sonar.api.utils.KeyValueFormatTest.java

@Test
public void formatBag() {
    TreeBag bag = new TreeBag();
    bag.add("hello", 1);
    bag.add("key", 3);
    assertThat(KeyValueFormat.format(bag, 0)).isEqualTo("hello=1;key=3");
}

From source file:org.sonar.api.utils.KeyValueFormatTest.java

@Test
public void formatBagWithVariationHack() {
    TreeBag bag = new TreeBag();
    bag.add("hello", 1);
    bag.add("key", 3);
    assertThat(KeyValueFormat.format(bag, -1)).isEqualTo("hello=0;key=2");
}