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