]> git.ktnx.net Git - mobile-ledger.git/commitdiff
replace .clone() with a copy constructor
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 20 Jul 2019 19:18:23 +0000 (22:18 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 20 Jul 2019 19:18:23 +0000 (22:18 +0300)
fixes a compiler warning

app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java

index f300da5d0a166a0f1a9675f0c72c20737ddbfe6a..f4cdae1d097b63f342ed4e313d0a5669e440dd6c 100644 (file)
@@ -112,8 +112,7 @@ public class ProfileDetailFragment extends Fragment implements HueRingDialog.Hue
                 mProfile.removeFromDB();
                 ArrayList<MobileLedgerProfile> oldList = Data.profiles.getValue();
                 if (oldList == null) throw new AssertionError();
-                ArrayList<MobileLedgerProfile> newList =
-                        (ArrayList<MobileLedgerProfile>) oldList.clone();
+                ArrayList<MobileLedgerProfile> newList = new ArrayList<>(oldList);
                 newList.remove(mProfile);
                 Data.profiles.setValue(newList);
                 if (mProfile.equals(Data.profile.getValue())) {
@@ -201,8 +200,7 @@ public class ProfileDetailFragment extends Fragment implements HueRingDialog.Hue
             mProfile.storeInDB();
             final ArrayList<MobileLedgerProfile> profiles = Data.profiles.getValue();
             if (profiles == null) throw new AssertionError();
-            ArrayList<MobileLedgerProfile> newList =
-                    (ArrayList<MobileLedgerProfile>) profiles.clone();
+            ArrayList<MobileLedgerProfile> newList = new ArrayList<>(profiles);
             newList.add(mProfile);
             Data.profiles.setValue(newList);
             MobileLedgerProfile.storeProfilesOrder();