GeezerVison is showing github.com — Merge pull request #384 from DevFactory/release/Redundant-Field-Initi… · coding0011/java-design-patterns@dfef28e
File treeExpand file treeCollapse file tree Open diff view settings caching/src/main/java/com/iluwatar/caching chain/src/main/java/com/iluwatar/chain fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy model-view-presenter/src/main/java/com/iluwatar/model/view/presenter monostate/src/main/java/com/iluwatar/monostate producer-consumer/src/main/java/com/iluwatar/producer/consumer reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock singleton/src/main/java/com/iluwatar/singleton twin/src/main/java/com/iluwatar/twin
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: caching/src/main/java/com/iluwatar/caching/CacheStore.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 31 | 31 | */ | 32 | 32 | public class CacheStore { | 33 | 33 |
| 34 | | - static LruCache cache = null; | | 34 | + static LruCache cache; | 35 | 35 |
| 36 | 36 | private CacheStore() { | 37 | 37 | } | |
Collapse file Copy file name to clipboardExpand all lines: caching/src/main/java/com/iluwatar/caching/LruCache.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,8 +50,8 @@ public Node(String userId, UserAccount userAccount) { | 50 | 50 |
| 51 | 51 | int capacity; | 52 | 52 | HashMap<String, Node> cache = new HashMap<>(); | 53 | | - Node head = null; | 54 | | - Node end = null; | | 53 | + Node head; | | 54 | + Node end; | 55 | 55 |
| 56 | 56 | public LruCache(int capacity) { | 57 | 57 | this.capacity = capacity; | |
Collapse file Copy file name to clipboardExpand all lines: chain/src/main/java/com/iluwatar/chain/Request.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -44,7 +44,7 @@ public class Request { | 44 | 44 | * Indicates if the request is handled or not. A request can only switch state from unhandled to | 45 | 45 | * handled, there's no way to 'unhandle' a request | 46 | 46 | */ | 47 | | - private boolean handled = false; | | 47 | + private boolean handled; | 48 | 48 |
| 49 | 49 | /** | 50 | 50 | * Create a new request of the given type and accompanied description. | |
Collapse file Copy file name to clipboardExpand all lines: fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy/DecoratingIterator.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -32,7 +32,7 @@ public abstract class DecoratingIterator<TYPE> implements Iterator<TYPE> { | 32 | 32 |
| 33 | 33 | protected final Iterator<TYPE> fromIterator; | 34 | 34 |
| 35 | | - private TYPE next = null; | | 35 | + private TYPE next; | 36 | 36 |
| 37 | 37 | /** | 38 | 38 | * Creates an iterator that decorates the given iterator. | |
Collapse file Copy file name to clipboardExpand all lines: fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy/LazyFluentIterable.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -111,7 +111,7 @@ public FluentIterable<TYPE> first(int count) { | 111 | 111 | @Override | 112 | 112 | public Iterator<TYPE> iterator() { | 113 | 113 | return new DecoratingIterator<TYPE>(iterable.iterator()) { | 114 | | - int currentIndex = 0; | | 114 | + int currentIndex; | 115 | 115 |
| 116 | 116 | @Override | 117 | 117 | public TYPE computeNext() { | @@ -156,7 +156,7 @@ public Iterator<TYPE> iterator() { | 156 | 156 | private int stopIndex; | 157 | 157 | private int totalElementsCount; | 158 | 158 | private List<TYPE> list; | 159 | | - private int currentIndex = 0; | | 159 | + private int currentIndex; | 160 | 160 |
| 161 | 161 | @Override | 162 | 162 | public TYPE computeNext() { | |
Collapse file Copy file name to clipboardExpand all lines: model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileLoader.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -37,7 +37,7 @@ public class FileLoader { | 37 | 37 | /** | 38 | 38 | * Indicates if the file is loaded or not. | 39 | 39 | */ | 40 | | - private boolean loaded = false; | | 40 | + private boolean loaded; | 41 | 41 |
| 42 | 42 | /** | 43 | 43 | * The name of the file that we want to load. | |
Collapse file Copy file name to clipboardExpand all lines: monostate/src/main/java/com/iluwatar/monostate/LoadBalancer.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 35 | 35 |
| 36 | 36 | public class LoadBalancer { | 37 | 37 | 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; | 40 | 40 |
| 41 | 41 | static { | 42 | 42 | servers.add(new Server("localhost", 8081, ++id)); | |
Collapse file Copy file name to clipboardExpand all lines: producer-consumer/src/main/java/com/iluwatar/producer/consumer/Producer.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -34,7 +34,7 @@ public class Producer { | 34 | 34 |
| 35 | 35 | private final String name; | 36 | 36 |
| 37 | | - private int itemId = 0; | | 37 | + private int itemId; | 38 | 38 |
| 39 | 39 | public Producer(String name, ItemQueue queue) { | 40 | 40 | this.name = name; | |
Collapse file Copy file name to clipboardExpand all lines: reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/ReaderWriterLock.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,7 +40,7 @@ public class ReaderWriterLock implements ReadWriteLock { | 40 | 40 |
| 41 | 41 | private Object readerMutex = new Object(); | 42 | 42 |
| 43 | | - private int currentReaderCount = 0; | | 43 | + private int currentReaderCount; | 44 | 44 |
| 45 | 45 | /** | 46 | 46 | * Global mutex is used to indicate that whether reader or writer gets the lock in the moment. | |
Collapse file Copy file name to clipboardExpand all lines: reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Writer.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 29 | 29 | */ | 30 | 30 | public class Writer implements Runnable { | 31 | 31 |
| 32 | | - private Lock writeLock = null; | | 32 | + private Lock writeLock; | 33 | 33 |
| 34 | 34 | private String name; | 35 | 35 |
| |
|