Code cleanup (#1461)
* Code cleanup * Fix flux tests * Fix checkstyle errors * Fix compile error
This commit is contained in:
@ -36,7 +36,7 @@ The main class in our example is the treasure chest that contains items.
|
||||
```java
|
||||
public class TreasureChest {
|
||||
|
||||
private List<Item> items;
|
||||
private final List<Item> items;
|
||||
|
||||
public TreasureChest() {
|
||||
items = List.of(
|
||||
@ -64,7 +64,7 @@ public class TreasureChest {
|
||||
public class Item {
|
||||
|
||||
private ItemType type;
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
public Item(ItemType type, String name) {
|
||||
this.setType(type);
|
||||
|
@ -36,7 +36,7 @@ import java.util.NoSuchElementException;
|
||||
*/
|
||||
public class BstIterator<T extends Comparable<T>> implements Iterator<TreeNode<T>> {
|
||||
|
||||
private ArrayDeque<TreeNode<T>> pathStack;
|
||||
private final ArrayDeque<TreeNode<T>> pathStack;
|
||||
|
||||
public BstIterator(TreeNode<T> root) {
|
||||
pathStack = new ArrayDeque<>();
|
||||
|
@ -31,7 +31,7 @@ package com.iluwatar.iterator.bst;
|
||||
*/
|
||||
public class TreeNode<T extends Comparable<T>> {
|
||||
|
||||
private T val;
|
||||
private final T val;
|
||||
private TreeNode<T> left;
|
||||
private TreeNode<T> right;
|
||||
|
||||
|
@ -29,7 +29,7 @@ package com.iluwatar.iterator.list;
|
||||
public class Item {
|
||||
|
||||
private ItemType type;
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
public Item(ItemType type, String name) {
|
||||
this.setType(type);
|
||||
|
@ -32,7 +32,7 @@ import java.util.List;
|
||||
*/
|
||||
public class TreasureChest {
|
||||
|
||||
private List<Item> items;
|
||||
private final List<Item> items;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -30,9 +30,9 @@ import com.iluwatar.iterator.Iterator;
|
||||
*/
|
||||
public class TreasureChestItemIterator implements Iterator<Item> {
|
||||
|
||||
private TreasureChest chest;
|
||||
private final TreasureChest chest;
|
||||
private int idx;
|
||||
private ItemType type;
|
||||
private final ItemType type;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
Reference in New Issue
Block a user