From: Damyan Ivanov Date: Sat, 20 Jul 2019 19:18:23 +0000 (+0300) Subject: replace .clone() with a copy constructor X-Git-Tag: v0.11.0~111 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=d857b003248bf4b3e8af018f83253700470ca41f;p=mobile-ledger.git replace .clone() with a copy constructor fixes a compiler warning --- diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java b/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java index f300da5d..f4cdae1d 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java @@ -112,8 +112,7 @@ public class ProfileDetailFragment extends Fragment implements HueRingDialog.Hue mProfile.removeFromDB(); ArrayList oldList = Data.profiles.getValue(); if (oldList == null) throw new AssertionError(); - ArrayList newList = - (ArrayList) oldList.clone(); + ArrayList 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 profiles = Data.profiles.getValue(); if (profiles == null) throw new AssertionError(); - ArrayList newList = - (ArrayList) profiles.clone(); + ArrayList newList = new ArrayList<>(profiles); newList.add(mProfile); Data.profiles.setValue(newList); MobileLedgerProfile.storeProfilesOrder();