v0.7.5a: removed unnecessary explicit type arguments

This commit is contained in:
Evan Debenham 2019-10-04 15:50:26 -04:00
parent c0d8a456b3
commit 009752822d
35 changed files with 55 additions and 55 deletions

View File

@ -30,7 +30,7 @@ import java.util.HashMap;
public class Script extends Program {
private static final HashMap<Class<? extends Script>,Script> all =
new HashMap<Class<? extends Script>, Script>();
new HashMap<>();
private static Script curScript = null;
private static Class<? extends Script> curScriptClass = null;

View File

@ -42,7 +42,7 @@ public class Atlas {
this.tx = tx;
tx.atlas = this;
namedFrames = new HashMap<Object, RectF>();
namedFrames = new HashMap<>();
}
public void add( Object key, int left, int top, int right, int bottom ) {

View File

@ -30,7 +30,7 @@ import java.util.ArrayList;
public class Camera extends Gizmo {
private static ArrayList<Camera> all = new ArrayList<Camera>();
private static ArrayList<Camera> all = new ArrayList<>();
protected static float invW2;
protected static float invH2;

View File

@ -38,7 +38,7 @@ public class Group extends Gizmo {
public static boolean freezeEmitters = false;
public Group() {
members = new ArrayList<Gizmo>();
members = new ArrayList<>();
length = 0;
}

View File

@ -36,7 +36,7 @@ public class TextureFilm {
private SmartTexture texture;
protected HashMap<Object,RectF> frames = new HashMap<Object, RectF>();
protected HashMap<Object,RectF> frames = new HashMap<>();
public TextureFilm( Object tx ) {

View File

@ -31,7 +31,7 @@ public class BitmapCache {
private static final String DEFAULT = "__default";
private static HashMap<String,Layer> layers = new HashMap<String, BitmapCache.Layer>();
private static HashMap<String,Layer> layers = new HashMap<>();
public static Pixmap get( String assetName ) {
return get( DEFAULT, assetName );

View File

@ -29,7 +29,7 @@ public class BitmapFilm {
public Pixmap bitmap;
protected HashMap<Object,Rect> frames = new HashMap<Object, Rect>();
protected HashMap<Object,Rect> frames = new HashMap<>();
public BitmapFilm( Pixmap bitmap ) {
this.bitmap = bitmap;

View File

@ -46,7 +46,7 @@ public class Bundle {
private static final String CLASS_NAME = "__className";
private static HashMap<String,String> aliases = new HashMap<String, String>();
private static HashMap<String,String> aliases = new HashMap<>();
private JSONObject data;
@ -226,7 +226,7 @@ public class Bundle {
public Collection<Bundlable> getCollection( String key ) {
ArrayList<Bundlable> list = new ArrayList<Bundlable>();
ArrayList<Bundlable> list = new ArrayList<>();
try {
JSONArray array = data.getJSONArray( key );

View File

@ -40,7 +40,7 @@ public class Graph {
node.distance( Integer.MAX_VALUE );
}
LinkedList<Node> queue = new LinkedList<Node>();
LinkedList<Node> queue = new LinkedList<>();
focus.distance( 0 );
queue.add( focus );
@ -63,7 +63,7 @@ public class Graph {
@SuppressWarnings("unchecked")
public static <T extends Node> List<T> buildPath( Collection<T> nodes, T from, T to ) {
List<T> path = new ArrayList<T>();
List<T> path = new ArrayList<>();
T room = from;
while (room != to) {

View File

@ -162,7 +162,7 @@ public class Badges {
}
private static HashSet<Badge> global;
private static HashSet<Badge> local = new HashSet<Badges.Badge>();
private static HashSet<Badge> local = new HashSet<>();
private static boolean saveNeeded = false;
@ -233,7 +233,7 @@ public class Badges {
global = restore( bundle );
} catch (IOException e) {
global = new HashSet<Badge>();
global = new HashSet<>();
}
}
}
@ -855,7 +855,7 @@ public class Badges {
public static List<Badge> filtered( boolean global ) {
HashSet<Badge> filtered = new HashSet<Badge>( global ? Badges.global : Badges.local );
HashSet<Badge> filtered = new HashSet<>(global ? Badges.global : Badges.local);
Iterator<Badge> iterator = filtered.iterator();
while (iterator.hasNext()) {
@ -889,7 +889,7 @@ public class Badges {
leaveBest( filtered, Badge.GAMES_PLAYED_1, Badge.GAMES_PLAYED_2, Badge.GAMES_PLAYED_3, Badge.GAMES_PLAYED_4 );
leaveBest( filtered, Badge.CHAMPION_1, Badge.CHAMPION_2, Badge.CHAMPION_3 );
ArrayList<Badge> list = new ArrayList<Badge>( filtered );
ArrayList<Badge> list = new ArrayList<>(filtered);
Collections.sort( list );
return list;

View File

@ -96,7 +96,7 @@ public class Bones {
Iterator<Item> iterator = hero.belongings.backpack.iterator();
Item curItem;
ArrayList<Item> items = new ArrayList<Item>();
ArrayList<Item> items = new ArrayList<>();
while (iterator.hasNext()){
curItem = iterator.next();
if (curItem.bones)

View File

@ -198,7 +198,7 @@ public class Dungeon {
for (LimitedDrops a : LimitedDrops.values())
a.count = 0;
chapters = new HashSet<Integer>();
chapters = new HashSet<>();
Ghost.Quest.reset();
Wandmaker.Quest.reset();
@ -413,7 +413,7 @@ public class Dungeon {
int depth = Dungeon.depth + 1;
ArrayList<Item> dropped = Dungeon.droppedItems.get( depth );
if (dropped == null) {
Dungeon.droppedItems.put( depth, dropped = new ArrayList<Item>() );
Dungeon.droppedItems.put( depth, dropped = new ArrayList<>() );
}
dropped.add( item );
}
@ -589,7 +589,7 @@ public class Dungeon {
LimitedDrops.restore( bundle.getBundle(LIMDROPS) );
chapters = new HashSet<Integer>();
chapters = new HashSet<>();
int ids[] = bundle.getIntArray( CHAPTERS );
if (ids != null) {
for (int id : ids) {

View File

@ -105,7 +105,7 @@ public class QuickSlot {
public Item randomNonePlaceholder(){
ArrayList<Item> result = new ArrayList<Item>();
ArrayList<Item> result = new ArrayList<>();
for (int i = 0; i < SIZE; i ++)
if (getItem(i) != null && !isPlaceholder(i))
result.add(getItem(i));
@ -123,7 +123,7 @@ public class QuickSlot {
*/
public void storePlaceholders(Bundle bundle){
ArrayList<Item> placeholders = new ArrayList<Item>(SIZE);
ArrayList<Item> placeholders = new ArrayList<>(SIZE);
boolean[] placements = new boolean[SIZE];
for (int i = 0; i < SIZE; i++)

View File

@ -31,7 +31,7 @@ import java.util.Collection;
public class PinCushion extends Buff {
private ArrayList<MissileWeapon> items = new ArrayList<MissileWeapon>();
private ArrayList<MissileWeapon> items = new ArrayList<>();
public void stick(MissileWeapon projectile){
for (Item item : items){
@ -60,7 +60,7 @@ public class PinCushion extends Buff {
@Override
public void restoreFromBundle(Bundle bundle) {
items = new ArrayList<MissileWeapon>((Collection<MissileWeapon>)((Collection<?>)bundle.getCollection( ITEMS )));
items = new ArrayList<>((Collection<MissileWeapon>) ((Collection<?>) bundle.getCollection(ITEMS)));
super.restoreFromBundle( bundle );
}
}

View File

@ -191,7 +191,7 @@ public class Hero extends Char {
belongings = new Belongings( this );
visibleEnemies = new ArrayList<Mob>();
visibleEnemies = new ArrayList<>();
}
public void updateHT( boolean boostHP ){
@ -1459,7 +1459,7 @@ public class Hero extends Char {
int pos = Dungeon.hero.pos;
ArrayList<Integer> passable = new ArrayList<Integer>();
ArrayList<Integer> passable = new ArrayList<>();
for (Integer ofs : PathFinder.NEIGHBOURS8) {
int cell = pos + ofs;
if ((Dungeon.level.passable[cell] || Dungeon.level.avoid[cell]) && Dungeon.level.heaps.get( cell ) == null) {
@ -1468,7 +1468,7 @@ public class Hero extends Char {
}
Collections.shuffle( passable );
ArrayList<Item> items = new ArrayList<Item>( Dungeon.hero.belongings.backpack.items );
ArrayList<Item> items = new ArrayList<>(Dungeon.hero.belongings.backpack.items);
for (Integer cell : passable) {
if (items.isEmpty()) {
break;

View File

@ -42,7 +42,7 @@ public class FloatingText extends RenderedText {
private float cameraZoom = -1;
private static final SparseArray<ArrayList<FloatingText>> stacks = new SparseArray<ArrayList<FloatingText>>();
private static final SparseArray<ArrayList<FloatingText>> stacks = new SparseArray<>();
public FloatingText() {
speed.y = - DISTANCE / LIFESPAN;
@ -123,7 +123,7 @@ public class FloatingText extends RenderedText {
ArrayList<FloatingText> stack = stacks.get(key);
if (stack == null) {
stack = new ArrayList<FloatingText>();
stack = new ArrayList<>();
stacks.put(key, stack);
}

View File

@ -56,7 +56,7 @@ public class SpellSprite extends Image {
private float duration;
private float passed;
private static HashMap<Char,SpellSprite> all = new HashMap<Char, SpellSprite>();
private static HashMap<Char,SpellSprite> all = new HashMap<>();
public SpellSprite() {
super( Assets.SPELL_ICONS );

View File

@ -55,7 +55,7 @@ public class Gold extends Item {
@Override
public ArrayList<String> actions( Hero hero ) {
return new ArrayList<String>();
return new ArrayList<>();
}
@Override

View File

@ -82,7 +82,7 @@ public class Heap implements Bundlable {
public boolean seen = false;
public boolean haunted = false;
public LinkedList<Item> items = new LinkedList<Item>();
public LinkedList<Item> items = new LinkedList<>();
public void open( Hero hero ) {
switch (type) {
@ -429,7 +429,7 @@ public class Heap implements Bundlable {
seen = bundle.getBoolean( SEEN );
type = Type.valueOf( bundle.getString( TYPE ) );
items = new LinkedList<Item>( (Collection<Item>) ((Collection<?>) bundle.getCollection( ITEMS )) );
items = new LinkedList<>((Collection<Item>) ((Collection<?>) bundle.getCollection(ITEMS)));
items.removeAll(Collections.singleton(null));
//remove any document pages that either don't exist anymore or that the player already has

View File

@ -100,7 +100,7 @@ public class Honeypot extends Item {
int newPos = pos;
if (Actor.findChar( pos ) != null) {
ArrayList<Integer> candidates = new ArrayList<Integer>();
ArrayList<Integer> candidates = new ArrayList<>();
boolean[] passable = Dungeon.level.passable;
for (int n : PathFinder.NEIGHBOURS4) {

View File

@ -92,7 +92,7 @@ public class Item implements Bundlable {
};
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = new ArrayList<String>();
ArrayList<String> actions = new ArrayList<>();
actions.add( AC_DROP );
actions.add( AC_THROW );
return actions;

View File

@ -43,9 +43,9 @@ public class ItemStatusHandler<T extends Item> {
this.itemLabels = new HashMap<>();
this.labelImages = new HashMap<>(labelImages);
known = new HashSet<Class<? extends T>>();
known = new HashSet<>();
ArrayList<String> labelsLeft = new ArrayList<String>( labelImages.keySet() );
ArrayList<String> labelsLeft = new ArrayList<>(labelImages.keySet());
for (int i=0; i < items.length; i++) {
@ -67,7 +67,7 @@ public class ItemStatusHandler<T extends Item> {
this.labelImages = new HashMap<>(labelImages);
known = new HashSet<>();
ArrayList<String> allLabels = new ArrayList<String>( labelImages.keySet() );
ArrayList<String> allLabels = new ArrayList<>(labelImages.keySet());
restore(bundle, allLabels);
}
@ -203,7 +203,7 @@ public class ItemStatusHandler<T extends Item> {
}
public HashSet<Class<? extends T>> unknown() {
HashSet<Class<? extends T>> result = new HashSet<Class<? extends T>>();
HashSet<Class<? extends T>> result = new HashSet<>();
for (Class<? extends T> i : items) {
if (!known.contains( i )) {
result.add( i );

View File

@ -131,7 +131,7 @@ public class DriedRose extends Artifact {
else if (charge != chargeCap) GLog.i( Messages.get(this, "no_charge") );
else if (cursed) GLog.i( Messages.get(this, "cursed") );
else {
ArrayList<Integer> spawnPoints = new ArrayList<Integer>();
ArrayList<Integer> spawnPoints = new ArrayList<>();
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
int p = hero.pos + PathFinder.NEIGHBOURS8[i];
if (Actor.findChar(p) == null && (Dungeon.level.passable[p] || Dungeon.level.avoid[p])) {
@ -371,7 +371,7 @@ public class DriedRose extends Artifact {
}
} else if (cursed && Random.Int(100) == 0) {
ArrayList<Integer> spawnPoints = new ArrayList<Integer>();
ArrayList<Integer> spawnPoints = new ArrayList<>();
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
int p = target.pos + PathFinder.NEIGHBOURS8[i];

View File

@ -48,7 +48,7 @@ public class Bag extends Item implements Iterable<Item> {
public Char owner;
public ArrayList<Item> items = new ArrayList<Item>();
public ArrayList<Item> items = new ArrayList<>();
public int size = 1;

View File

@ -75,7 +75,7 @@ public class ScrollOfMirrorImage extends Scroll {
//returns the number of images spawned
public static int spawnImages( Hero hero, int nImages ){
ArrayList<Integer> respawnPoints = new ArrayList<Integer>();
ArrayList<Integer> respawnPoints = new ArrayList<>();
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
int p = hero.pos + PathFinder.NEIGHBOURS8[i];

View File

@ -292,7 +292,7 @@ public class WandOfRegrowth extends Wand {
int nDrops = Random.NormalIntRange(3, 6);
ArrayList<Integer> candidates = new ArrayList<Integer>();
ArrayList<Integer> candidates = new ArrayList<>();
for (int i : PathFinder.NEIGHBOURS8){
if (Dungeon.level.passable[pos+i]
&& pos+i != Dungeon.level.entrance
@ -328,7 +328,7 @@ public class WandOfRegrowth extends Wand {
int nSeeds = Random.NormalIntRange(2, 4);
ArrayList<Integer> candidates = new ArrayList<Integer>();
ArrayList<Integer> candidates = new ArrayList<>();
for (int i : PathFinder.NEIGHBOURS8){
if (Dungeon.level.passable[pos+i]
&& pos+i != Dungeon.level.entrance

View File

@ -35,8 +35,8 @@ import java.util.LinkedHashMap;
public abstract class Room extends Rect implements Graph.Node, Bundlable {
public ArrayList<Room> neigbours = new ArrayList<Room>();
public LinkedHashMap<Room, Door> connected = new LinkedHashMap<Room, Door>();
public ArrayList<Room> neigbours = new ArrayList<>();
public LinkedHashMap<Room, Door> connected = new LinkedHashMap<>();
public int distance;
public int price = 1;

View File

@ -72,7 +72,7 @@ public class Swiftthistle extends Plant {
}
private float left;
ArrayList<Integer> presses = new ArrayList<Integer>();
ArrayList<Integer> presses = new ArrayList<>();
@Override
public int icon() {

View File

@ -44,7 +44,7 @@ public class AttackIndicator extends Tag {
private CharSprite sprite = null;
private static Mob lastTarget;
private ArrayList<Mob> candidates = new ArrayList<Mob>();
private ArrayList<Mob> candidates = new ArrayList<>();
public AttackIndicator() {
super( DangerIndicator.COLOR );

View File

@ -36,7 +36,7 @@ import java.util.ArrayList;
public class BadgesList extends ScrollPane {
private ArrayList<ListItem> items = new ArrayList<ListItem>();
private ArrayList<ListItem> items = new ArrayList<>();
public BadgesList( boolean global ) {
super( new Component() );

View File

@ -39,7 +39,7 @@ public class GameLog extends Component implements Signal.Listener<String> {
private RenderedTextMultiline lastEntry;
private int lastColor;
private static ArrayList<Entry> entries = new ArrayList<Entry>();
private static ArrayList<Entry> entries = new ArrayList<>();
public GameLog() {
super();

View File

@ -294,7 +294,7 @@ public class QuickRecipe extends Component {
i = 0;
}
Item item = (Item) Reflection.newInstance(cls);
ArrayList<Item> in = new ArrayList<Item>(Arrays.asList(new Bomb(), item));
ArrayList<Item> in = new ArrayList<>(Arrays.asList(new Bomb(), item));
result.add(new QuickRecipe( r, in, r.sampleOutput(in)));
i++;
}

View File

@ -34,7 +34,7 @@ public class GLog {
public static final String WARNING = "** ";
public static final String HIGHLIGHT = "@@ ";
public static Signal<String> update = new Signal<String>();
public static Signal<String> update = new Signal<>();
public static void i( String text, Object... args ) {

View File

@ -49,7 +49,7 @@ public class WndStory extends Window {
public static final int ID_CITY = 3;
public static final int ID_HALLS = 4;
private static final SparseArray<String> CHAPTERS = new SparseArray<String>();
private static final SparseArray<String> CHAPTERS = new SparseArray<>();
static {
CHAPTERS.put( ID_SEWERS, "sewers" );

View File

@ -37,7 +37,7 @@ import java.util.ArrayList;
public class WndTabbed extends Window {
protected ArrayList<Tab> tabs = new ArrayList<WndTabbed.Tab>();
protected ArrayList<Tab> tabs = new ArrayList<>();
protected Tab selected;
public WndTabbed() {
@ -100,7 +100,7 @@ public class WndTabbed extends Window {
remove( tab );
}
ArrayList<Tab> tabs = new ArrayList<WndTabbed.Tab>( this.tabs );
ArrayList<Tab> tabs = new ArrayList<>(this.tabs);
this.tabs.clear();
for (Tab tab : tabs) {