Skip to content

Commit

Permalink
squid:S2293 - The diamond operator should be used
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammed Ezzat committed Jan 29, 2016
1 parent 1a55f3a commit 409ff02
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion caching/src/main/java/com/iluwatar/caching/DbManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private DbManager() {
*/
public static void createVirtualDb() {
useMongoDB = false;
virtualDB = new HashMap<String, UserAccount>();
virtualDB = new HashMap<>();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions caching/src/main/java/com/iluwatar/caching/LruCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public Node(String userId, UserAccount userAccount) {
}

int capacity;
HashMap<String, Node> cache = new HashMap<String, Node>();
HashMap<String, Node> cache = new HashMap<>();
Node head = null;
Node end = null;

Expand Down Expand Up @@ -140,7 +140,7 @@ public void clear() {
* 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
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);
Expand Down
4 changes: 2 additions & 2 deletions composite/src/main/java/com/iluwatar/composite/Messenger.java
Original file line number Diff line number Diff line change
Expand Up @@ -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'))));
Expand All @@ -35,7 +35,7 @@ LetterComposite messageFromOrcs() {

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'))));
Expand Down
2 changes: 1 addition & 1 deletion dao/src/main/java/com/iluwatar/dao/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static List<Customer> generateSampleCustomers() {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public List<CakeInfo> getAllCakes() {
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()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public List<Spell> findAllSpells() {
@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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public class Wizard extends BaseEntity {

public Wizard() {
spellbooks = new HashSet<Spellbook>();
spellbooks = new HashSet<>();
}

public Wizard(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class ServiceCache {
private final Map<String, Service> serviceCache;

public ServiceCache() {
serviceCache = new HashMap<String, Service>();
serviceCache = new HashMap<>();
}

/**
Expand Down

0 comments on commit 409ff02

Please sign in to comment.