clone

java: best way to do deep copy of list of lists

十年热恋 提交于 2020-08-26 13:45:22
问题 I am trying to write a procedure do the deep copy of List<List<Integer>> , and I am doing like this: public static List<List<Integer>> clone(final List<List<Integer>> src) { List<List<Integer>> dest = new ArrayList<List<Integer>>(); for( List<Integer> sublist : src) { List<Integer> temp = new ArrayList<Integer>(); for(Integer val: sublist) { temp.add(val); } dest.add(temp); } return dest ; } Is this a good way to do? Is it possible to get rid of the inner loop? The fact is that each of the

java: best way to do deep copy of list of lists

我只是一个虾纸丫 提交于 2020-08-26 13:45:08
问题 I am trying to write a procedure do the deep copy of List<List<Integer>> , and I am doing like this: public static List<List<Integer>> clone(final List<List<Integer>> src) { List<List<Integer>> dest = new ArrayList<List<Integer>>(); for( List<Integer> sublist : src) { List<Integer> temp = new ArrayList<Integer>(); for(Integer val: sublist) { temp.add(val); } dest.add(temp); } return dest ; } Is this a good way to do? Is it possible to get rid of the inner loop? The fact is that each of the

Cloning from GitHub on Jenkins: could not load PEM client certificate

左心房为你撑大大i 提交于 2020-08-26 04:58:22
问题 I set up a build server and want to clone a project in Jenkins. I get the following error: fatal: unable to access 'https://github.com/habitat-sh/sample-node-app/': could not load PEM client certificate, LibreSSL error error:02FFF00D:system library:func(4095):Permission denied, (no key found, wrong pass phrase, or wrong file format?) It is on public GitHub, no certificates should be needed, everything is working correctly when I clone on terminal. Also, curl works without any problems. Do you

How to clone a UserPrincipal object in VB.NET

我怕爱的太早我们不能终老 提交于 2020-08-10 18:54:58
问题 I'm trying to create a new User in Active Directory from a VB.NET application. Most fields will be identical to an already existing "template" user, except things like Name, SurName, Email, SamAccountName, etc. So I want to copy or clone this template User, assign the few fields with a new/different value and then save this new user in Active Directory. I'd like to avoid having to manually assign who-knows how many properties from my template to the new User and maybe forget something along

How to clone a UserPrincipal object in VB.NET

泪湿孤枕 提交于 2020-08-10 18:54:53
问题 I'm trying to create a new User in Active Directory from a VB.NET application. Most fields will be identical to an already existing "template" user, except things like Name, SurName, Email, SamAccountName, etc. So I want to copy or clone this template User, assign the few fields with a new/different value and then save this new user in Active Directory. I'd like to avoid having to manually assign who-knows how many properties from my template to the new User and maybe forget something along

How to create a “clone”-able enumerator for external iteration?

。_饼干妹妹 提交于 2020-08-07 05:36:24
问题 I want to create an enumerator for external iteration via next that is clone -able, so that the clone retains the current enumeration state. As an example, let's say I have a method that returns an enumerator which yields square numbers: def square_numbers return enum_for(__method__) unless block_given? n = d = 1 loop do yield n d += 2 n += d end end square_numbers.take(10) #=> [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] And I want to enumerate the first 5 square numbers, and for each value, print