Second pass of trivial modernizations
- Replace unnecessary getters/setters with inline assignments - Simplify string constructions - Improve containers construction
This commit is contained in:
@@ -295,7 +295,7 @@ public class UserSettingsCommand {
|
||||
isSettingsRole = user != null && user.isSettingsRole();
|
||||
isShareRole = user != null && user.isShareRole();
|
||||
isLdapAuthenticated = user != null && user.isLdapAuthenticated();
|
||||
setNewUser(false);
|
||||
isNewUser = false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public enum TranscodeScheme {
|
||||
if (this == OFF) {
|
||||
return "No limit";
|
||||
}
|
||||
return "" + getMaxBitRate() + " Kbps";
|
||||
return getMaxBitRate() + " Kbps";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -234,8 +234,8 @@ public class TransferStatus {
|
||||
this.active = active;
|
||||
|
||||
if (active) {
|
||||
setBytesSkipped(0L);
|
||||
setBytesTotal(0L);
|
||||
bytesSkipped = 0L;
|
||||
bytesTotal = 0L;
|
||||
setBytesTransfered(0L);
|
||||
} else {
|
||||
createSample(getBytesTransfered(), true);
|
||||
@@ -281,10 +281,9 @@ public class TransferStatus {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("TransferStatus-").append(hashCode()).append(" [player: ").append(player.getId()).append(", file: ");
|
||||
builder.append(file).append(", terminated: ").append(terminated).append(", active: ").append(active).append("]");
|
||||
return builder.toString();
|
||||
String builder = "TransferStatus-" + hashCode() + " [player: " + player.getId() + ", file: " +
|
||||
file + ", terminated: " + terminated + ", active: " + active + "]";
|
||||
return builder;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -183,9 +183,8 @@ public class LastFmService {
|
||||
*/
|
||||
public List<MediaFile> getSimilarSongs(org.airsonic.player.domain.Artist artist, int count,
|
||||
List<MusicFolder> musicFolders) throws IOException {
|
||||
List<MediaFile> similarSongs = new ArrayList<MediaFile>();
|
||||
|
||||
similarSongs.addAll(mediaFileDao.getSongsByArtist(artist.getName(), 0, 1000));
|
||||
List<MediaFile> similarSongs = new ArrayList<MediaFile>(mediaFileDao.getSongsByArtist(artist.getName(), 0, 1000));
|
||||
for (org.airsonic.player.domain.Artist similarArtist : getSimilarArtists(artist, 100, false, musicFolders)) {
|
||||
similarSongs.addAll(mediaFileDao.getSongsByArtist(similarArtist.getName(), 0, 1000));
|
||||
}
|
||||
|
||||
@@ -606,7 +606,7 @@ public class SettingsService {
|
||||
* @param limit The download bitrate limit in Kbit/s. Zero if unlimited.
|
||||
*/
|
||||
public void setDownloadBitrateLimit(long limit) {
|
||||
setProperty(KEY_DOWNLOAD_BITRATE_LIMIT, "" + limit);
|
||||
setProperty(KEY_DOWNLOAD_BITRATE_LIMIT, String.valueOf(limit));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -464,7 +464,7 @@ public class SonosService implements SonosSoap {
|
||||
if (StringUtils.isNumeric(part)) {
|
||||
result.add(Integer.parseInt(part));
|
||||
} else {
|
||||
int dashIndex = part.indexOf("-");
|
||||
int dashIndex = part.indexOf('-');
|
||||
int from = Integer.parseInt(part.substring(0, dashIndex));
|
||||
int to = Integer.parseInt(part.substring(dashIndex + 1));
|
||||
for (int i = from; i <= to; i++) {
|
||||
|
||||
@@ -118,9 +118,7 @@ public class SonosHelper {
|
||||
List<MediaFile> albums = searchService.getRandomAlbums(40, musicFolders);
|
||||
List<MediaFile> songs = new ArrayList<MediaFile>();
|
||||
for (MediaFile album : albums) {
|
||||
for (MediaFile file : filterMusic(mediaFileService.getChildrenOf(album, true, false, false))) {
|
||||
songs.add(file);
|
||||
}
|
||||
songs.addAll(filterMusic(mediaFileService.getChildrenOf(album, true, false, false)));
|
||||
}
|
||||
Collections.shuffle(songs);
|
||||
songs = songs.subList(0, Math.min(count, songs.size()));
|
||||
|
||||
Reference in New Issue
Block a user