Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c00dbf8

Browse files
remove warnings
1 parent ea9d779 commit c00dbf8

File tree

6 files changed

+70
-75
lines changed

6 files changed

+70
-75
lines changed

‎src/com/example/dao/InMemoryWorldDao.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
* @author Binnur Kurt (binnur.kurt@gmail.com)
1616
*/
1717
public class InMemoryWorldDao implements WorldDao {
18-
private Map<String, Country> countries;
19-
private Map<Integer, City> cities;
20-
private Set<String> continents;
18+
private finalMap<String, Country> countries;
19+
private finalMap<Integer, City> cities;
20+
private finalSet<String> continents;
2121

2222
public void createCities1() {
2323
cities.put(1, new City(1, "Kabul", "AFG", 1780000));

‎src/com/example/service/MovieService.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ public interface MovieService {
2020

2121
Collection<Movie> findAllMoviesByDirectorId(int directorId);
2222

23-
Collection<Movie> findAllMoviesByYearRangeAndGenre(String genre,
24-
int fromYear, int toYear);
23+
Collection<Movie> findAllMoviesByYearRangeAndGenre(String genre, int fromYear, int toYear);
2524

2625
Collection<Movie> findAllMoviesByGenre(String genre);
2726

2827
Collection<Movie> findAllMoviesByCriteria(CriteriaBean criteria);
2928

30-
Movie addMovie(int id, String title, int year, String imdb,
31-
List<Genre> genres, List<Director> directors);
29+
Movie addMovie(int id, String title, int year, String imdb, List<Genre> genres, List<Director> directors);
3230

3331
Genre findGenreByName(String genre);
3432

‎src/com/example/util/CitySummaryStatistics.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.example.util;
22

3+
import com.example.domain.City;
4+
35
import java.util.Comparator;
46
import java.util.function.Consumer;
57

6-
import com.example.domain.City;
7-
88
/**
99
* @author Binnur Kurt <binnur.kurt@gmail.com>
1010
*/
@@ -23,14 +23,14 @@ public CitySummaryStatistics(Comparator<City> comparator) {
2323

2424
@Override
2525
public void accept(City city) {
26-
count++;
27-
min = min!=null && comparator.compare(min,city)<=0 ? min : city;
28-
max = max!=null && comparator.compare(max,city)>=0 ? max : city;
26+
count++;
27+
min = min != null && comparator.compare(min,city) <= 0 ? min : city;
28+
max = max != null && comparator.compare(max,city) >= 0 ? max : city;
2929
}
3030

3131
public void combine(CitySummaryStatistics other) {
32-
this.min= comparator.compare(this.min,other.min)<=0 ? this.min : other.min;
33-
this.max= comparator.compare(this.max,other.max)>=0 ? this.max : other.max;
32+
this.min= comparator.compare(this.min,other.min) <= 0 ? this.min : other.min;
33+
this.max= comparator.compare(this.max,other.max) >= 0 ? this.max : other.max;
3434
}
3535

3636
public City getMin() {

‎src/com/example/util/CountryCitySummaryStatistics.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package com.example.util;
22

3+
import com.example.domain.City;
4+
import com.example.domain.Country;
5+
36
import java.util.Comparator;
47
import java.util.function.Consumer;
58
import java.util.function.Supplier;
69

7-
import com.example.domain.City;
8-
import com.example.domain.Country;
9-
1010
/**
1111
* @author Binnur Kurt <binnur.kurt@gmail.com>
1212
*/
@@ -20,14 +20,14 @@ public CountryCitySummaryStatistics() {
2020

2121
@Override
2222
public void accept(Country country) {
23-
Supplier<CitySummaryStatistics> citySummaryStatisticsSupplier=
23+
Supplier<CitySummaryStatistics> citySummaryStatisticsSupplier=
2424
() -> new CitySummaryStatistics(Comparator.comparingLong(City::getPopulation));
25-
var css= country.getCities()
26-
.stream()
27-
.collect(citySummaryStatisticsSupplier,CitySummaryStatistics::accept,CitySummaryStatistics::combine);
28-
min= css.getMin();
29-
max= css.getMax();
30-
count= css.getCount();
25+
var css= country.getCities()
26+
.stream()
27+
.collect(citySummaryStatisticsSupplier,CitySummaryStatistics::accept,CitySummaryStatistics::combine);
28+
min= css.getMin();
29+
max= css.getMax();
30+
count= css.getCount();
3131
}
3232

3333
public void combine(CountryCitySummaryStatistics other) {
Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,65 @@
11
package com.example.util;
22

3+
import com.example.domain.Country;
4+
35
import java.util.Comparator;
46
import java.util.function.Consumer;
57

6-
import com.example.domain.Country;
7-
88
/**
99
* @author Binnur Kurt <binnur.kurt@gmail.com>
1010
*/
1111
public class CountrySummaryStatistics implements Consumer<Country> {
12-
private Comparator<Country> comparator;
13-
private Country min;
14-
private Country max;
15-
private long count;
12+
private Comparator<Country> comparator;
13+
private Country min;
14+
private Country max;
15+
private long count;
1616

17-
public CountrySummaryStatistics() {
18-
}
17+
public CountrySummaryStatistics() {
18+
}
1919

20-
public CountrySummaryStatistics(Comparator<Country> comparator) {
21-
this.comparator = comparator;
22-
}
20+
public CountrySummaryStatistics(Comparator<Country> comparator) {
21+
this.comparator = comparator;
22+
}
2323

24-
@Override
25-
public void accept(Country value) {
26-
count++;
27-
min = min != null && comparator.compare(min, value) <= 0 ? min : value;
28-
max = max != null && comparator.compare(max, value) >= 0 ? max : value;
29-
}
24+
@Override
25+
public void accept(Country value) {
26+
count++;
27+
min = min != null && comparator.compare(min, value) <= 0 ? min : value;
28+
max = max != null && comparator.compare(max, value) >= 0 ? max : value;
29+
}
3030

31-
public void combine(CountrySummaryStatistics other) {
32-
this.min = comparator.compare(this.min, other.min) <= 0 ? this.min : other.min;
33-
this.max = comparator.compare(this.max, other.max) >= 0 ? this.max : other.max;
34-
}
31+
public void combine(CountrySummaryStatistics other) {
32+
this.min = comparator.compare(this.min, other.min) <= 0 ? this.min : other.min;
33+
this.max = comparator.compare(this.max, other.max) >= 0 ? this.max : other.max;
34+
}
3535

36-
public Country getMin() {
37-
return min;
38-
}
36+
public Country getMin() {
37+
return min;
38+
}
3939

40-
public void setMin(Country min) {
41-
this.min = min;
42-
}
40+
public void setMin(Country min) {
41+
this.min = min;
42+
}
4343

44-
public Country getMax() {
45-
return max;
46-
}
44+
public Country getMax() {
45+
return max;
46+
}
4747

48-
public void setMax(Country max) {
49-
this.max = max;
50-
}
48+
public void setMax(Country max) {
49+
this.max = max;
50+
}
5151

52-
public long getCount() {
53-
return count;
54-
}
52+
public long getCount() {
53+
return count;
54+
}
5555

56-
public void setCount(long count) {
57-
this.count = count;
58-
}
56+
public void setCount(long count) {
57+
this.count = count;
58+
}
5959

60-
@Override
61-
public String toString() {
62-
return "CountrySummaryStatistics{" + "min=" + getMin() + ", max=" + getMax() + ", count=" + getCount() + '}';
63-
}
60+
@Override
61+
public String toString() {
62+
return "CountrySummaryStatistics{" + "min=" + getMin() + ", max=" + getMax() + ", count=" + getCount() + '}';
63+
}
6464

6565
}

‎src/com/example/util/DoubleSummaryGaussianStatistics.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* @author Binnur Kurt <binnur.kurt@gmail.com>
77
*/
88
public class DoubleSummaryGaussianStatistics extends DoubleSummaryStatistics {
9-
private double stdVariance;
109
private double Mk;
1110
private double Qk;
1211

@@ -18,8 +17,8 @@ public void accept(double value) {
1817
Qk = 0.;
1918
} else {
2019
double difference = value - Mk;
21-
Mk += difference/getCount();
22-
Qk += ((getCount()-1)*difference*difference)/getCount();
20+
Mk += difference / getCount();
21+
Qk += ((getCount() - 1) * difference * difference) / getCount();
2322
}
2423
}
2524

@@ -29,20 +28,18 @@ public void combine(DoubleSummaryStatistics other) {
2928
}
3029

3130
public double getVariance() {
32-
double variance = Qk / (getCount() - 1);
33-
return variance;
31+
return Qk / (getCount() - 1);
3432
}
3533

3634
public double getStdVariance() {
37-
stdVariance= Math.sqrt (Qk/getCount());
38-
return stdVariance;
35+
return Math.sqrt(Qk / getCount());
3936
}
4037

4138
@Override
4239
public String toString() {
4340
return "DoubleSummaryGaussianStatistics{" +
4441
"variance=" + getVariance() +
4542
", stdVariance=" + getStdVariance() +
46-
"}\n"+super.toString();
43+
"}\n" + super.toString();
4744
}
4845
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /