Fixed many warnings

This commit is contained in:
Ziver Koc 2018-05-27 01:23:21 +02:00
parent c570847f3a
commit ccecc067b2
160 changed files with 951 additions and 1151 deletions

View file

@ -32,7 +32,7 @@ import java.util.Random;
/**
* This code may be used, modified, and redistributed provided that the
* This code may be used, modified, and redistributed provided that the
* author tag below remains intact.
*
* @author Ian Clarke <ian@uprizer.com>
@ -41,13 +41,13 @@ import java.util.Random;
public class BloomFilterTest extends TestCase {
public void testBloomFilter() {
DecimalFormat df = new DecimalFormat("0.00000");
Random r = new Random(124445l);
Random r = new Random(124445L);
int bfSize = 400000;
System.out.println("Testing " + bfSize + " bit SimpleBloomFilter");
for (int i = 5; i < 10; i++) {
int addCount = 10000 * (i + 1);
BloomFilter<Integer> bf = new BloomFilter<Integer>(bfSize, addCount);
HashSet<Integer> added = new HashSet<Integer>();
BloomFilter<Integer> bf = new BloomFilter<>(bfSize, addCount);
HashSet<Integer> added = new HashSet<>();
for (int x = 0; x < addCount; x++) {
int num = r.nextInt();
added.add(num);

View file

@ -40,7 +40,7 @@ public class CircularBufferTest {
@Test
public void addToEmpty() {
CircularBuffer<Integer> buff = new CircularBuffer<Integer>(0);
CircularBuffer<Integer> buff = new CircularBuffer<>(0);
try {
buff.add(10);
fail("IndexOutOfBoundsException was not thrown");
@ -49,7 +49,7 @@ public class CircularBufferTest {
@Test
public void addOneElement() {
CircularBuffer<Integer> buff = new CircularBuffer<Integer>(1);
CircularBuffer<Integer> buff = new CircularBuffer<>(1);
assertEquals(0, buff.size());
buff.add(10);
assertEquals(1, buff.size());
@ -58,7 +58,7 @@ public class CircularBufferTest {
@Test
public void addThreeElements() {
CircularBuffer<Integer> buff = new CircularBuffer<Integer>(10);
CircularBuffer<Integer> buff = new CircularBuffer<>(10);
buff.add(10);
buff.add(11);
buff.add(12);
@ -70,7 +70,7 @@ public class CircularBufferTest {
@Test
public void addOutOfRange() {
CircularBuffer<Integer> buff = new CircularBuffer<Integer>(2);
CircularBuffer<Integer> buff = new CircularBuffer<>(2);
buff.add(10);
buff.add(11);
buff.add(12);
@ -85,7 +85,7 @@ public class CircularBufferTest {
@Test(expected = NoSuchElementException.class)
public void iteratorEmpty() {
CircularBuffer<Integer> buff = new CircularBuffer<Integer>(10);
CircularBuffer<Integer> buff = new CircularBuffer<>(10);
Iterator<Integer> it = buff.iterator();
assert (!it.hasNext());
@ -94,7 +94,7 @@ public class CircularBufferTest {
@Test(expected = NoSuchElementException.class)
public void iteratorThreeElements() {
CircularBuffer<Integer> buff = new CircularBuffer<Integer>(10);
CircularBuffer<Integer> buff = new CircularBuffer<>(10);
buff.add(10);
buff.add(11);
buff.add(12);

View file

@ -42,7 +42,7 @@ public class ObjectCacheTest {
@Test
public void emptyCache() throws InterruptedException {
public void emptyCache() {
ObjectCache cache = new ObjectCache(10);
assertFalse(cache.containsKey(KEY));
assertEquals(0, cache.size());
@ -78,6 +78,7 @@ public class ObjectCacheTest {
//@Test
// This TC does not work
@SuppressWarnings("RedundantStringConstructorCall")
public void javaGRC() throws InterruptedException {
ObjectCache cache = new ObjectCache(10000);
{