Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
programming_tips_and_tricks [2017/05/16 20:28] ledyxprogramming_tips_and_tricks [2021/02/07 03:15] (current) – external edit 127.0.0.1
Line 647: Line 647:
 === 합병 정렬(Merge Sort) === === 합병 정렬(Merge Sort) ===
 [[algorithm:Merge Sort | 합병 정렬(Merge Sort)]] [[algorithm:Merge Sort | 합병 정렬(Merge Sort)]]
- 
- 
-= Design Pattern = 
- 
-== Serialization을 이용한 Deep Copy == 
-<sxh java> 
-/* Java */ 
-@SuppressWarnings("unchecked") 
-public static <T> T deepCopy(T obj) { 
- try { 
- ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
- ObjectOutputStream oos = new ObjectOutputStream(baos); 
- oos.writeObject(obj); 
- 
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); 
- ObjectInputStream ois = new ObjectInputStream(bais); 
- return (T) ois.readObject(); 
- } catch (IOException e) { 
- return null; 
- } catch (ClassNotFoundException e) { 
- return null; 
- } 
-} 
-</sxh> 
-https://github.com/xeyez/CSharp-PrototypePattern 
- 
-<sxh csharp> 
-/* C# */ 
-public static T DeepCopy<T>(T obj) 
-{ 
-        using (var ms = new MemoryStream()) 
-        { 
-            var formatter = new BinaryFormatter(); 
-            formatter.Serialize(ms, obj); 
-            ms.Position = 0; 
- 
-            return (T)formatter.Deserialize(ms); 
-        } 
-} 
-</sxh> 
-https://github.com/xeyez/Java-PrototypePattern 
- 
- 
  
  
Line 1034: Line 991:
     }     }
 } }
 +</sxh>
 +
 +
 += Intellij - Git Bash 연동 =
 +
 +Tools -> Terminal
 +
 +<sxh bash>
 +"C:\Program Files\Git\bin\sh.exe" -login -i
 </sxh> </sxh>
programming_tips_and_tricks.1494962921.txt.gz · Last modified: 2021/02/07 03:15 (external edit)