squid:S2293 - The diamond operator should be used
This commit is contained in:
parent
1a55f3a420
commit
409ff027b8
@ -37,7 +37,7 @@ public class DbManager {
|
|||||||
*/
|
*/
|
||||||
public static void createVirtualDb() {
|
public static void createVirtualDb() {
|
||||||
useMongoDB = false;
|
useMongoDB = false;
|
||||||
virtualDB = new HashMap<String, UserAccount>();
|
virtualDB = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,7 +27,7 @@ public class LruCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int capacity;
|
int capacity;
|
||||||
HashMap<String, Node> cache = new HashMap<String, Node>();
|
HashMap<String, Node> cache = new HashMap<>();
|
||||||
Node head = null;
|
Node head = null;
|
||||||
Node end = null;
|
Node end = null;
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ public class LruCache {
|
|||||||
* Returns cache data in list form.
|
* Returns cache data in list form.
|
||||||
*/
|
*/
|
||||||
public ArrayList<UserAccount> getCacheDataInListForm() {
|
public ArrayList<UserAccount> getCacheDataInListForm() {
|
||||||
ArrayList<UserAccount> listOfCacheData = new ArrayList<UserAccount>();
|
ArrayList<UserAccount> listOfCacheData = new ArrayList<>();
|
||||||
Node temp = head;
|
Node temp = head;
|
||||||
while (temp != null) {
|
while (temp != null) {
|
||||||
listOfCacheData.add(temp.userAccount);
|
listOfCacheData.add(temp.userAccount);
|
||||||
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public abstract class LetterComposite {
|
public abstract class LetterComposite {
|
||||||
|
|
||||||
private List<LetterComposite> children = new ArrayList<LetterComposite>();
|
private List<LetterComposite> children = new ArrayList<>();
|
||||||
|
|
||||||
public void add(LetterComposite letter) {
|
public void add(LetterComposite letter) {
|
||||||
children.add(letter);
|
children.add(letter);
|
||||||
|
@ -13,7 +13,7 @@ public class Messenger {
|
|||||||
|
|
||||||
LetterComposite messageFromOrcs() {
|
LetterComposite messageFromOrcs() {
|
||||||
|
|
||||||
List<Word> words = new ArrayList<Word>();
|
List<Word> words = new ArrayList<>();
|
||||||
|
|
||||||
words.add(new Word(Arrays.asList(new Letter('W'), new Letter('h'), new Letter('e'), new Letter(
|
words.add(new Word(Arrays.asList(new Letter('W'), new Letter('h'), new Letter('e'), new Letter(
|
||||||
'r'), new Letter('e'))));
|
'r'), new Letter('e'))));
|
||||||
@ -35,7 +35,7 @@ public class Messenger {
|
|||||||
|
|
||||||
LetterComposite messageFromElves() {
|
LetterComposite messageFromElves() {
|
||||||
|
|
||||||
List<Word> words = new ArrayList<Word>();
|
List<Word> words = new ArrayList<>();
|
||||||
|
|
||||||
words.add(new Word(Arrays.asList(new Letter('M'), new Letter('u'), new Letter('c'), new Letter(
|
words.add(new Word(Arrays.asList(new Letter('M'), new Letter('u'), new Letter('c'), new Letter(
|
||||||
'h'))));
|
'h'))));
|
||||||
|
@ -52,7 +52,7 @@ public class App {
|
|||||||
final Customer customer1 = new Customer(1, "Adam", "Adamson");
|
final Customer customer1 = new Customer(1, "Adam", "Adamson");
|
||||||
final Customer customer2 = new Customer(2, "Bob", "Bobson");
|
final Customer customer2 = new Customer(2, "Bob", "Bobson");
|
||||||
final Customer customer3 = new Customer(3, "Carl", "Carlson");
|
final Customer customer3 = new Customer(3, "Carl", "Carlson");
|
||||||
final List<Customer> customers = new ArrayList<Customer>();
|
final List<Customer> customers = new ArrayList<>();
|
||||||
customers.add(customer1);
|
customers.add(customer1);
|
||||||
customers.add(customer2);
|
customers.add(customer2);
|
||||||
customers.add(customer3);
|
customers.add(customer3);
|
||||||
|
@ -18,7 +18,7 @@ public class CustomerDaoImplTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
customers = new ArrayList<Customer>();
|
customers = new ArrayList<>();
|
||||||
customers.add(CUSTOMER);
|
customers.add(CUSTOMER);
|
||||||
impl = new CustomerDaoImpl(customers);
|
impl = new CustomerDaoImpl(customers);
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ public class CakeBakingServiceImpl implements CakeBakingService {
|
|||||||
CakeToppingInfo cakeToppingInfo =
|
CakeToppingInfo cakeToppingInfo =
|
||||||
new CakeToppingInfo(cake.getTopping().getId(), cake.getTopping().getName(), cake
|
new CakeToppingInfo(cake.getTopping().getId(), cake.getTopping().getName(), cake
|
||||||
.getTopping().getCalories());
|
.getTopping().getCalories());
|
||||||
ArrayList<CakeLayerInfo> cakeLayerInfos = new ArrayList<CakeLayerInfo>();
|
ArrayList<CakeLayerInfo> cakeLayerInfos = new ArrayList<>();
|
||||||
for (CakeLayer layer : cake.getLayers()) {
|
for (CakeLayer layer : cake.getLayers()) {
|
||||||
cakeLayerInfos.add(new CakeLayerInfo(layer.getId(), layer.getName(), layer.getCalories()));
|
cakeLayerInfos.add(new CakeLayerInfo(layer.getId(), layer.getName(), layer.getCalories()));
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ public class SimpleMessageQueue implements MessageQueue {
|
|||||||
private final BlockingQueue<Message> queue;
|
private final BlockingQueue<Message> queue;
|
||||||
|
|
||||||
public SimpleMessageQueue(int bound) {
|
public SimpleMessageQueue(int bound) {
|
||||||
queue = new ArrayBlockingQueue<Message>(bound);
|
queue = new ArrayBlockingQueue<>(bound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,7 +11,7 @@ public class ItemQueue {
|
|||||||
|
|
||||||
public ItemQueue() {
|
public ItemQueue() {
|
||||||
|
|
||||||
queue = new LinkedBlockingQueue<Item>(5);
|
queue = new LinkedBlockingQueue<>(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void put(Item item) throws InterruptedException {
|
public void put(Item item) throws InterruptedException {
|
||||||
|
@ -48,13 +48,13 @@ public class MagicServiceImpl implements MagicService {
|
|||||||
@Override
|
@Override
|
||||||
public List<Wizard> findWizardsWithSpellbook(String name) {
|
public List<Wizard> findWizardsWithSpellbook(String name) {
|
||||||
Spellbook spellbook = spellbookDao.findByName(name);
|
Spellbook spellbook = spellbookDao.findByName(name);
|
||||||
return new ArrayList<Wizard>(spellbook.getWizards());
|
return new ArrayList<>(spellbook.getWizards());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Wizard> findWizardsWithSpell(String name) {
|
public List<Wizard> findWizardsWithSpell(String name) {
|
||||||
Spell spell = spellDao.findByName(name);
|
Spell spell = spellDao.findByName(name);
|
||||||
Spellbook spellbook = spell.getSpellbook();
|
Spellbook spellbook = spell.getSpellbook();
|
||||||
return new ArrayList<Wizard>(spellbook.getWizards());
|
return new ArrayList<>(spellbook.getWizards());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,8 @@ import com.iluwatar.servicelayer.wizard.Wizard;
|
|||||||
public class Spellbook extends BaseEntity {
|
public class Spellbook extends BaseEntity {
|
||||||
|
|
||||||
public Spellbook() {
|
public Spellbook() {
|
||||||
spells = new HashSet<Spell>();
|
spells = new HashSet<>();
|
||||||
wizards = new HashSet<Wizard>();
|
wizards = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Spellbook(String name) {
|
public Spellbook(String name) {
|
||||||
|
@ -24,7 +24,7 @@ import com.iluwatar.servicelayer.spellbook.Spellbook;
|
|||||||
public class Wizard extends BaseEntity {
|
public class Wizard extends BaseEntity {
|
||||||
|
|
||||||
public Wizard() {
|
public Wizard() {
|
||||||
spellbooks = new HashSet<Spellbook>();
|
spellbooks = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Wizard(String name) {
|
public Wizard(String name) {
|
||||||
|
@ -16,7 +16,7 @@ public class ServiceCache {
|
|||||||
private final Map<String, Service> serviceCache;
|
private final Map<String, Service> serviceCache;
|
||||||
|
|
||||||
public ServiceCache() {
|
public ServiceCache() {
|
||||||
serviceCache = new HashMap<String, Service>();
|
serviceCache = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user