Skip to content

Commit b2ee9bb

Browse files
committed
Remove redundant generic type definitions
1 parent 215dc66 commit b2ee9bb

File tree

62 files changed

+197
-202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+197
-202
lines changed

src/main/java/ldbc/snb/datagen/LdbcDatagen.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public int runGenerateJob(Configuration conf) throws Exception {
8888

8989
String hadoopPrefix = conf.get("ldbc.snb.datagen.serializer.hadoopDir");
9090
FileSystem fs = FileSystem.get(conf);
91-
ArrayList<Float> percentages = new ArrayList<Float>();
91+
ArrayList<Float> percentages = new ArrayList<>();
9292
percentages.add(0.45f);
9393
percentages.add(0.45f);
9494
percentages.add(0.1f);
@@ -143,7 +143,7 @@ public int runGenerateJob(Configuration conf) throws Exception {
143143

144144
fs.delete(new Path(DatagenParams.hadoopDir + "/persons"), true);
145145
printProgress("Merging the different edge files");
146-
ArrayList<String> edgeFileNames = new ArrayList<String>();
146+
ArrayList<String> edgeFileNames = new ArrayList<>();
147147
edgeFileNames.add(hadoopPrefix + "/universityEdges");
148148
edgeFileNames.add(hadoopPrefix + "/interestEdges");
149149
edgeFileNames.add(hadoopPrefix + "/randomEdges");
@@ -189,8 +189,8 @@ public int runGenerateJob(Configuration conf) throws Exception {
189189

190190
printProgress("Sorting update streams ");
191191

192-
List<String> personStreamsFileNames = new ArrayList<String>();
193-
List<String> forumStreamsFileNames = new ArrayList<String>();
192+
List<String> personStreamsFileNames = new ArrayList<>();
193+
List<String> forumStreamsFileNames = new ArrayList<>();
194194
for (int i = 0; i < DatagenParams.numThreads; ++i) {
195195
int numPartitions = conf.getInt("ldbc.snb.datagen.serializer.numUpdatePartitions", 1);
196196
for (int j = 0; j < numPartitions; ++j) {

src/main/java/ldbc/snb/datagen/dictionary/BrowserDictionary.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public class BrowserDictionary {
5252

5353
public BrowserDictionary(double probAnotherBrowser) {
5454
probAnotherBrowser_ = probAnotherBrowser;
55-
browsers_ = new ArrayList<String>();
56-
cumulativeDistribution_ = new ArrayList<Double>();
55+
browsers_ = new ArrayList<>();
56+
cumulativeDistribution_ = new ArrayList<>();
5757
load(DatagenParams.browserDictonryFile);
5858
}
5959

src/main/java/ldbc/snb/datagen/dictionary/CompanyDictionary.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ public CompanyDictionary(PlaceDictionary placeDictionary,
7979

8080
this.placeDictionary = placeDictionary;
8181
this.probUnCorrelatedCompany = probUnCorrelatedCompany;
82-
this.companyName = new TreeMap<Long, String>();
83-
this.companyCountry = new TreeMap<Long, Integer>();
82+
this.companyName = new TreeMap<>();
83+
this.companyCountry = new TreeMap<>();
8484
this.companiesByCountry = new TreeMap<Integer, ArrayList<Long>>();
8585
for (Integer id : placeDictionary.getCountries()) {
86-
this.companiesByCountry.put(id, new ArrayList<Long>());
86+
this.companiesByCountry.put(id, new ArrayList<>());
8787
}
8888
load(DatagenParams.companiesDictionaryFile);
8989
}

src/main/java/ldbc/snb/datagen/dictionary/EmailDictionary.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ private void load(String fileName) {
7070
BufferedReader emailDictionary = new BufferedReader(
7171
new InputStreamReader(getClass().getResourceAsStream(fileName), "UTF-8"));
7272

73-
emails = new ArrayList<String>();
74-
cumulativeDistribution = new ArrayList<Double>();
73+
emails = new ArrayList<>();
74+
cumulativeDistribution = new ArrayList<>();
7575

7676
String line;
7777
double cummulativeDist = 0.0;

src/main/java/ldbc/snb/datagen/dictionary/FlashmobTagDictionary.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private void initialize() {
117117
for (int i = 0; i < numFlashmobTags; ++i) {
118118
ArrayList<FlashmobTag> instances = flashmobTags.get(tags[i]);
119119
if (instances == null) {
120-
instances = new ArrayList<FlashmobTag>();
120+
instances = new ArrayList<>();
121121
flashmobTags.put(tags[i], instances);
122122
}
123123
FlashmobTag flashmobTag = new FlashmobTag();
@@ -174,7 +174,7 @@ private boolean selectFlashmobTag(Random rand, int index) {
174174
* @param[in] fromDate The date from which to consider the flashmob tags.
175175
*/
176176
public ArrayList<FlashmobTag> generateFlashmobTags(Random rand, TreeSet<Integer> interests, long fromDate) {
177-
ArrayList<FlashmobTag> result = new ArrayList<FlashmobTag>();
177+
ArrayList<FlashmobTag> result = new ArrayList<>();
178178
Iterator<Integer> it = interests.iterator();
179179
while (it.hasNext()) {
180180
Integer tag = it.next();

src/main/java/ldbc/snb/datagen/dictionary/IPAddressDictionary.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public IPAddressDictionary(PlaceDictionary locationDic) {
7777
*/
7878
private void load(String mappingFileName, String baseIPdir) {
7979
String line;
80-
HashMap<String, String> countryAbbreMap = new HashMap<String, String>();
80+
HashMap<String, String> countryAbbreMap = new HashMap<>();
8181
try {
8282
BufferedReader mappingFile = new BufferedReader(new InputStreamReader(getClass()
8383
.getResourceAsStream(mappingFileName), "UTF-8"));
@@ -91,7 +91,7 @@ private void load(String mappingFileName, String baseIPdir) {
9191

9292
ArrayList<Integer> countries = placeDictionary.getCountries();
9393
for (int i = 0; i < countries.size(); i++) {
94-
ipsByCountry.put(countries.get(i), new ArrayList<IP>());
94+
ipsByCountry.put(countries.get(i), new ArrayList<>());
9595

9696
//Get the name of file
9797
String fileName = countryAbbreMap.get(placeDictionary.getPlaceName(countries.get(i)));

src/main/java/ldbc/snb/datagen/dictionary/LanguageDictionary.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public LanguageDictionary(PlaceDictionary locationDic,
8383
this.placeDictionary = locationDic;
8484
this.probEnglish = probEnglish;
8585
this.probSecondLang = probSecondLang;
86-
this.languages = new ArrayList<String>();
86+
this.languages = new ArrayList<>();
8787
this.officalLanguagesByCountry = new HashMap<Integer, ArrayList<Integer>>();
8888
this.languagesByCountry = new HashMap<Integer, ArrayList<Integer>>();
8989
load(DatagenParams.languageDictionaryFile);
@@ -96,8 +96,8 @@ public LanguageDictionary(PlaceDictionary locationDic,
9696
private void load(String fileName) {
9797
try {
9898
for (Integer id : placeDictionary.getCountries()) {
99-
officalLanguagesByCountry.put(id, new ArrayList<Integer>());
100-
languagesByCountry.put(id, new ArrayList<Integer>());
99+
officalLanguagesByCountry.put(id, new ArrayList<>());
100+
languagesByCountry.put(id, new ArrayList<>());
101101
}
102102
BufferedReader dictionary = new BufferedReader(new InputStreamReader(getClass()
103103
.getResourceAsStream(fileName), "UTF-8"));
@@ -146,7 +146,7 @@ public String getLanguageName(int languageId) {
146146
* @breif Gets a set of random languages from a country.
147147
*/
148148
public ArrayList<Integer> getLanguages(Random random, int country) {
149-
ArrayList<Integer> langSet = new ArrayList<Integer>();
149+
ArrayList<Integer> langSet = new ArrayList<>();
150150
if (officalLanguagesByCountry.get(country).size() != 0) {
151151
int id = random.nextInt(officalLanguagesByCountry.get(country).size());
152152
langSet.add(officalLanguagesByCountry.get(country).get(id));

src/main/java/ldbc/snb/datagen/dictionary/NamesDictionary.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public NamesDictionary(PlaceDictionary locationDic) {
6969
private void init() {
7070
surNamesByLocations = new HashMap<Integer, Vector<String>>();
7171
for (Integer id : locationDic.getCountries()) {
72-
surNamesByLocations.put(id, new Vector<String>());
72+
surNamesByLocations.put(id, new Vector<>());
7373
}
7474

7575
//assume that there is only 2 periods of birthyears
@@ -80,8 +80,8 @@ private void init() {
8080
givenNamesByLocationsMale.add(new HashMap<Integer, Vector<String>>());
8181
givenNamesByLocationsFemale.add(new HashMap<Integer, Vector<String>>());
8282
for (Integer id : locationDic.getCountries()) {
83-
givenNamesByLocationsMale.lastElement().put(id, new Vector<String>());
84-
givenNamesByLocationsFemale.lastElement().put(id, new Vector<String>());
83+
givenNamesByLocationsMale.lastElement().put(id, new Vector<>());
84+
givenNamesByLocationsFemale.lastElement().put(id, new Vector<>());
8585
}
8686
}
8787

src/main/java/ldbc/snb/datagen/dictionary/PlaceDictionary.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ public int compareTo(PlaceZOrder obj) {
106106
* @brief Creator.
107107
*/
108108
public PlaceDictionary() {
109-
this.countryNames = new HashMap<String, Integer>();
110-
this.cityNames = new HashMap<String, Integer>();
111-
this.places = new HashMap<Integer, Place>();
112-
this.isPartOf = new HashMap<Integer, Integer>();
113-
this.countries = new ArrayList<Integer>();
109+
this.countryNames = new HashMap<>();
110+
this.cityNames = new HashMap<>();
111+
this.places = new HashMap<>();
112+
this.isPartOf = new HashMap<>();
113+
this.countries = new ArrayList<>();
114114
this.citiesByCountry = new HashMap<Integer, ArrayList<Integer>>();
115115
load(DatagenParams.cityDictionaryFile, DatagenParams.countryDictionaryFile);
116116
}
@@ -128,7 +128,7 @@ public Set<Integer> getPlaces() {
128128
* @brief Gets a list of the country ids.
129129
*/
130130
public ArrayList<Integer> getCountries() {
131-
return new ArrayList<Integer>(countries);
131+
return new ArrayList<>(countries);
132132
}
133133

134134
/**
@@ -302,7 +302,7 @@ private void readCountries(String fileName) {
302302
BufferedReader dictionary = new BufferedReader(
303303
new InputStreamReader(getClass().getResourceAsStream(fileName), "UTF-8"));
304304

305-
ArrayList<Float> temporalCumulative = new ArrayList<Float>();
305+
ArrayList<Float> temporalCumulative = new ArrayList<>();
306306

307307
String line;
308308
while ((line = dictionary.readLine()) != null) {
@@ -323,7 +323,7 @@ private void readCountries(String fileName) {
323323
temporalCumulative.add(dist);
324324
countries.add(place.getId());
325325

326-
citiesByCountry.put(place.getId(), new ArrayList<Integer>());
326+
citiesByCountry.put(place.getId(), new ArrayList<>());
327327
}
328328
dictionary.close();
329329
cumulativeDistribution = new Float[temporalCumulative.size()];
@@ -338,7 +338,7 @@ private void readCountries(String fileName) {
338338
* @brief Reads a continents file name.
339339
*/
340340
private void readContinents(String fileName) {
341-
HashMap<String, Integer> treatedContinents = new HashMap<String, Integer>();
341+
HashMap<String, Integer> treatedContinents = new HashMap<>();
342342
try {
343343
BufferedReader dictionary = new BufferedReader(
344344
new InputStreamReader(getClass().getResourceAsStream(fileName), "UTF-8"));

src/main/java/ldbc/snb/datagen/dictionary/PopularPlacesDictionary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public PopularPlacesDictionary(PlaceDictionary locationDic) {
6262
this.placeDictionary = locationDic;
6363
this.popularPlacesByCountry = new HashMap<Integer, ArrayList<PopularPlace>>();
6464
for (Integer id : placeDictionary.getCountries()) {
65-
this.popularPlacesByCountry.put(id, new ArrayList<PopularPlace>());
65+
this.popularPlacesByCountry.put(id, new ArrayList<>());
6666
}
6767
load(DatagenParams.popularDictionaryFile);
6868
}

0 commit comments

Comments
 (0)