可能重复:
如何克隆ArrayList并克隆其内容?
试图制作一个ArrayList的副本.底层对象很简单,包含字符串,整数,BigDecimals,Dates和DateTime对象.如何确保对新ArrayList所做的修改不会反映在旧的ArrayList中?
Person morts = new Person("whateva");
List<Person> oldList = new ArrayList<Person>();
oldList.add(morts);
oldList.get(0).setName("Mortimer");
List<Person> newList = new ArrayList<Person>();
newList.addAll(oldList);
newList.get(0).setName("Rupert");
System.out.println("oldName : " + oldList.get(0).getName());
System.out.println("newName : " + newList.get(0).getName());
Run Code Online (Sandbox Code Playgroud)
干杯,P
JdbcTemplate对象和SimpleJdbcTemplate之间有什么区别?
任何人都可以解释为什么我的团队成员在提交此 git reset 命令后无法将更改推送到 master 分支(更改将使 repo 恢复几次提交):
git reset --hard (previous commit SHA)
Run Code Online (Sandbox Code Playgroud)
这是尝试 git push 后收到的错误:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@xxxxx.com:xxx/xxxx.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)
分支 master 受到保护,因此只有“开发人员 + 维护人员”可以推送到它。
我的队友是有问题的 Gitlab …