Skip to content

Commit 0003c6c

Browse files
author
Mohammed Ezzat
committed
pmd:RedundantFieldInitializer - Redundant-Field-Initializer
1 parent 57be8aa commit 0003c6c

File tree

12 files changed

+15
-15
lines changed

12 files changed

+15
-15
lines changed

caching/src/main/java/com/iluwatar/caching/CacheStore.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*/
3232
public class CacheStore {
3333

34-
static LruCache cache = null;
34+
static LruCache cache;
3535

3636
private CacheStore() {
3737
}

caching/src/main/java/com/iluwatar/caching/LruCache.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public Node(String userId, UserAccount userAccount) {
5050

5151
int capacity;
5252
HashMap<String, Node> cache = new HashMap<>();
53-
Node head = null;
54-
Node end = null;
53+
Node head;
54+
Node end;
5555

5656
public LruCache(int capacity) {
5757
this.capacity = capacity;

chain/src/main/java/com/iluwatar/chain/Request.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class Request {
4444
* Indicates if the request is handled or not. A request can only switch state from unhandled to
4545
* handled, there's no way to 'unhandle' a request
4646
*/
47-
private boolean handled = false;
47+
private boolean handled;
4848

4949
/**
5050
* Create a new request of the given type and accompanied description.

fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy/DecoratingIterator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public abstract class DecoratingIterator<TYPE> implements Iterator<TYPE> {
3232

3333
protected final Iterator<TYPE> fromIterator;
3434

35-
private TYPE next = null;
35+
private TYPE next;
3636

3737
/**
3838
* Creates an iterator that decorates the given iterator.

fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy/LazyFluentIterable.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public FluentIterable<TYPE> first(int count) {
111111
@Override
112112
public Iterator<TYPE> iterator() {
113113
return new DecoratingIterator<TYPE>(iterable.iterator()) {
114-
int currentIndex = 0;
114+
int currentIndex;
115115

116116
@Override
117117
public TYPE computeNext() {
@@ -156,7 +156,7 @@ public Iterator<TYPE> iterator() {
156156
private int stopIndex;
157157
private int totalElementsCount;
158158
private List<TYPE> list;
159-
private int currentIndex = 0;
159+
private int currentIndex;
160160

161161
@Override
162162
public TYPE computeNext() {

model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileLoader.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class FileLoader {
3737
/**
3838
* Indicates if the file is loaded or not.
3939
*/
40-
private boolean loaded = false;
40+
private boolean loaded;
4141

4242
/**
4343
* The name of the file that we want to load.

monostate/src/main/java/com/iluwatar/monostate/LoadBalancer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535

3636
public class LoadBalancer {
3737
private static List<Server> servers = new ArrayList<>();
38-
private static int id = 0;
39-
private static int lastServedId = 0;
38+
private static int id;
39+
private static int lastServedId;
4040

4141
static {
4242
servers.add(new Server("localhost", 8081, ++id));

producer-consumer/src/main/java/com/iluwatar/producer/consumer/Producer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class Producer {
3434

3535
private final String name;
3636

37-
private int itemId = 0;
37+
private int itemId;
3838

3939
public Producer(String name, ItemQueue queue) {
4040
this.name = name;

reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/ReaderWriterLock.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class ReaderWriterLock implements ReadWriteLock {
4040

4141
private Object readerMutex = new Object();
4242

43-
private int currentReaderCount = 0;
43+
private int currentReaderCount;
4444

4545
/**
4646
* Global mutex is used to indicate that whether reader or writer gets the lock in the moment.

reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Writer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
*/
3030
public class Writer implements Runnable {
3131

32-
private Lock writeLock = null;
32+
private Lock writeLock;
3333

3434
private String name;
3535

singleton/src/main/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTower.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*/
3232
public class ThreadSafeLazyLoadedIvoryTower {
3333

34-
private static ThreadSafeLazyLoadedIvoryTower instance = null;
34+
private static ThreadSafeLazyLoadedIvoryTower instance;
3535

3636
private ThreadSafeLazyLoadedIvoryTower() {}
3737

twin/src/main/java/com/iluwatar/twin/BallItem.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131
public class BallItem extends GameItem {
3232

33-
private boolean isSuspended = false;
33+
private boolean isSuspended;
3434

3535
private BallThread twin;
3636

0 commit comments

Comments
 (0)