From 1453287d5495727d8e57af889acb71da5d630c85 Mon Sep 17 00:00:00 2001 From: Nirav Radadiya Date: Fri, 25 Mar 2022 00:12:13 -0300 Subject: [PATCH] Update --- Collections/.project | 11 +++ .../collectionsutils/CollectionsDemo.java | 90 +++++++++++------- .../cdac/collections/list/LinkedListDemo.java | 12 +-- EncryptionDecryption/.project | 11 +++ EncryptionDecryption/bin/.gitignore | 1 - .../com/cdac/encrypt/aes/AESEncryption.class | Bin 3725 -> 1361 bytes .../com/cdac/encrypt/aes/encryptdecrypt.class | Bin 0 -> 3179 bytes .../bin/snippet/Snippet.class | Bin 0 -> 262 bytes .../com/cdac/encrypt/aes/AESEncryption.java | 26 +++-- EncryptionDecryption/src/snippet/Snippet.java | 2 +- ExceptionHandling/.project | 11 +++ FileIO/.project | 11 +++ Generics/.project | 11 +++ InterviewPrograms/.project | 11 +++ JavaEnums/.project | 11 +++ Networking/.project | 11 +++ Reflections/.project | 11 +++ Threads/.project | 11 +++ 18 files changed, 189 insertions(+), 52 deletions(-) delete mode 100644 EncryptionDecryption/bin/.gitignore create mode 100644 EncryptionDecryption/bin/com/cdac/encrypt/aes/encryptdecrypt.class create mode 100644 EncryptionDecryption/bin/snippet/Snippet.class diff --git a/Collections/.project b/Collections/.project index c461daf..7747fd9 100644 --- a/Collections/.project +++ b/Collections/.project @@ -14,4 +14,15 @@ org.eclipse.jdt.core.javanature + + + 1648176090312 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/Collections/src/com/cdac/collections/collectionsutils/CollectionsDemo.java b/Collections/src/com/cdac/collections/collectionsutils/CollectionsDemo.java index 954db7a..148adfe 100644 --- a/Collections/src/com/cdac/collections/collectionsutils/CollectionsDemo.java +++ b/Collections/src/com/cdac/collections/collectionsutils/CollectionsDemo.java @@ -9,7 +9,6 @@ import java.util.Set; public class CollectionsDemo { - public static void main(String[] args) { ArrayList list = new ArrayList<>(); list.add("One"); @@ -51,14 +50,14 @@ public static void main(String[] args) { String min = Collections.min(list); System.out.println("Min Element in the List : "+min); - List iList = new ArrayList<>(); - iList.add(10); - iList.add(20); - iList.add(40); - iList.add(30); + List indexList = new ArrayList<>(); //iList name is not understadable can be converted to List 2 or IndexList + indexList.add(10); + indexList.add(20); + indexList.add(40); + indexList.add(30); //Binary Search in List Collection - int index = Collections.binarySearch(iList, 190); + int index = Collections.binarySearch(indexList, 190); System.out.println("Binary Search of 190 index is : "+index); //Copy one list to another list @@ -71,36 +70,57 @@ public static void main(String[] args) { newList.add(14); newList.add(15); //newList should have minimum size as iList - Collections.copy(newList, iList); + Collections.copy(newList, indexList); System.out.println("Copying the list from another list : "+newList); - - //Creating Immutable Collection - Set emptySet = Collections.emptySet(); - List emptyList = Collections.emptyList(); - Map emptyMap = Collections.emptyMap(); - System.out.println("Creating immutable collection (list, set, map)"); - System.out.println("Empty Set : "+emptySet.size()); - //emptySet.add("Try"); //not allowed its immutable - - //replacing all the elements with the new value - Collections.replaceAll(iList, 10, 100); - System.out.println("Replacing all the 10 in the list with 100 :"); - System.out.println(iList); - - //shuffling the list - Collections.shuffle(iList); - System.out.println("Shuffle the Elements in the List : "); - System.out.println(iList); + methodCalling(indexList); //Calling all methods from one place - //Creating singleton Collection Set, List, Map - Set singletonSet = Collections.singleton("Java"); - System.out.println("Creating singleton Collection : "); - System.out.println(singletonSet); -// singletonSet.add("Hello"); //not supported its immutable + } + + static void methodCalling(List indexList) + { + immutableCollection(); // Extracted Method + replaceAndShuffle(indexList); // Extracted Method + singletonCollection(); // Extracted Method + synchronizedCollection(); // Extracted Method + } + static void immutableCollection() + { + //Creating Immutable Collection + Set emptySet = Collections.emptySet(); + List emptyList = Collections.emptyList(); + Map emptyMap = Collections.emptyMap(); + System.out.println("Creating immutable collection (list, set, map)"); + System.out.println("Empty Set : "+emptySet.size()); + //emptySet.add("Try"); //not allowed its immutable + } + + static void replaceAndShuffle(List indexList) + { + //replacing all the elements with the new value + Collections.replaceAll(indexList, 10, 100); + System.out.println("Replacing all the 10 in the list with 100 :"); + System.out.println(indexList); + + //shuffling the list + Collections.shuffle(indexList); + System.out.println("Shuffle the Elements in the List : "); + System.out.println(indexList); + } + + static void singletonCollection() + { + //Creating singleton Collection Set, List, Map + Set singletonSet = Collections.singleton("Java"); + //singletonSet.add("Hello"); //not supported its immutable + System.out.println("Creating singleton Collection : "); + System.out.println(singletonSet); + } - //Creating synchronized Collection List, Set, Map - Map map = new HashMap<>(); - map = Collections.synchronizedMap(map); - System.out.println("Creating synchronizing Collection : "); + static void synchronizedCollection() + { + //Creating synchronized Collection List, Set, Map + Map map = new HashMap<>(); + map = Collections.synchronizedMap(map); + System.out.println("Creating synchronizing Collection : "); } } \ No newline at end of file diff --git a/Collections/src/com/cdac/collections/list/LinkedListDemo.java b/Collections/src/com/cdac/collections/list/LinkedListDemo.java index a2176ae..50a8f61 100644 --- a/Collections/src/com/cdac/collections/list/LinkedListDemo.java +++ b/Collections/src/com/cdac/collections/list/LinkedListDemo.java @@ -22,9 +22,9 @@ public static void main(String[] args) { osList.addLast("WebOS"); //GET ELEMENT - String firstElt = osList.getFirst(); - String lastElt = osList.getLast(); - String eltAtZero = osList.get(0); + String FirstElement = osList.getFirst(); + String LastElement = osList.getLast(); + String elementAtZero = osList.get(0); //GET ELEMENTS USING PEEK AND POLL //PEEK MEANS RETRIEVES THE ELEMENTS BUT DOES NOT REMOVE THE ELEMENT @@ -54,13 +54,13 @@ public static void main(String[] args) { } //Removes first Element - String elt = osList.remove(); + String Element = osList.remove(); //Removes element at given index - elt = osList.remove(2); + Element = osList.remove(2); //Removes First Element - elt = osList.removeFirst(); + Element = osList.removeFirst(); //Removes Last Element osList.removeLast(); diff --git a/EncryptionDecryption/.project b/EncryptionDecryption/.project index 2197d2e..153f5ee 100644 --- a/EncryptionDecryption/.project +++ b/EncryptionDecryption/.project @@ -14,4 +14,15 @@ org.eclipse.jdt.core.javanature + + + 1648176090459 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/EncryptionDecryption/bin/.gitignore b/EncryptionDecryption/bin/.gitignore deleted file mode 100644 index d728ce5..0000000 --- a/EncryptionDecryption/bin/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/snippet/ diff --git a/EncryptionDecryption/bin/com/cdac/encrypt/aes/AESEncryption.class b/EncryptionDecryption/bin/com/cdac/encrypt/aes/AESEncryption.class index 86148c98c542a0320022dfd23aa82214efb050b1..b328de9ac4fc51578c58b451904041f156cfec77 100644 GIT binary patch delta 729 zcmZ9KT~8BH5Qd+#3*Bv5wQO5Up};~#r3$4Af<@)q&w?OEgNYZ7Z3w2eglts2;TL$( z?6p5aFA9-_YvY~wM*oR%wp%qZCpk0o&O3A7Ip@6Z{}zdS{q^|-m}IjNnQxr*gu)h` zgc{%9q`DRM>b~Pv-nx!kcPh0Pd;7btNzALN(QtyK!C6J75lzI}xpJjNvFIV?eNdT! zKKc#Pis;MI>r$>-s%_^s-MyXKw#5L0-Vf!N35G0&$#@}cDm20cgY({kme4OU>TPL` zy5zmnviUJ`2IGoYtIYS~Iw!NO~K3a>Qg((X|o?uapZ; zggn>$0aFnY%vf9(72SH$%rk3ogPY!jKKne+oW(qY3e&9zdVTt$#S$4gs6D31iXtB5 zoyT=&IhfulI3{-#Ry(eg1@Y_eS=^W7zUWIayZHZw%zELDwD&ALe83P2UETyV@#HaN zHzdl5Rbo4{hnOE*>4@xp8qUxqyA=?`o{}icX~BcypLEEAx*aXr_Nr|k5x1jFdXI3P ze&U>+ZE{)c@d5cQ`|2T6M@%;~ofdBUqd92ff{@y!#jbr*pie zFeanLMRP);qkfck z{7XeZ!9#{sOc^=dNSP(WUM{;S-E>kzqnS}}nYT(RS`=)%s6VZz3VLZV^+fifX}Ag^ zj%nDYd(K=|aBy6Fzmk$FtdvtWjZ~)oIm6YUg5V_~8JJHi*qY-v8Z&bl*Upy~6~v?h z&w#hb6I*?s?uvyT&6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QF7AlK|Dm}Sj#jL7Jk~Z5YpY>zthI^< zYdC!VCK9n!6~{T=M&Dele+2_IJX*zjs~F}!=aWe(ds@g!nK8<6&zGq0o|7jh8vA$M zJjOx?oea{s5Z&8M=XTJ&eQ4!VbvOFahR3i6v)GFgcSSfIp39iR`?w0CfcFy@CK7pM zI1BL9NlbGVWUzc)dBG|n;wli)ZQ^JZPhUk?j32u}7XoxI!z)0H^K9WknUy}K4LHQz zBMkKs2HVcS5;%-bCh{oX9ZAX`qw^`A>cRya$5ZH86}FB~ND>6_B%Z}58QL`Acn;4~ z=LI?Y6lb5Nl~x4*M;8Jr;wmpfMaAVaDxPT}CVWQt1Q4V6Yq^ORu5(;Xo<31{+jxO@exOuoF{Q!Eub>6-~-gZ{; ziw1F(>oWF-nZ9d&N)NC~fiq;^S(elo`T95?X zJ-yBv4^X;|NxZ>5kvjf|wxHr#8-eGG(GTJc(pO-dj@^_&Z1RG*jrd$=4ZrEAqQ*#8 z@cSD6xH^bGzk?w5&?%5CA+l);W*ERMT{_PI=41eI4?bB`s{^=)+X4KQ>H_#1{?0MR R*_&+Q|6n+;bNnYF{|Dz9dK3Tv diff --git a/EncryptionDecryption/bin/com/cdac/encrypt/aes/encryptdecrypt.class b/EncryptionDecryption/bin/com/cdac/encrypt/aes/encryptdecrypt.class new file mode 100644 index 0000000000000000000000000000000000000000..ba1137f2f5749075fd5a56b4dd3689555caecf80 GIT binary patch literal 3179 zcma)8X;%|h7=CVmOfrs3qk^DTEQl;>T!5-rD`8Otlp3J5ap{nZ5Dl3$Gf`=4S8Mlu zxBF^szqp(eIQ1NVKz~%*=iW(>)%qp(&b{yYJn#G7{Qb{gcL6lxPYphSnz%h4jwj4` z*hC&HNj<@NkN27)Yft8B9+1Cb| zuth-2NR3pQSl0K*RJQRfdZ>Nt&X!gk+p$x_4uQ4G0Qt^klkP;g-*Oyt)ap!*T8?XA z7n%i@Ft47pQQxspYF?BJTVb@@(Q4pP>?Ym`Wtp4$Sfn8qk*MyK43mor9xX(I z%=R&vRJn%71vdOoJqFND^xC_kI`(6)guK&08T>lBaY(~Kfx6i_AF-pk_*i>t)FuRD z<6RfyR>n=*X#+i~@Dz?w*NmSV%$ji)Wv{f;Cs11ie<(Gl z#wS!Kl{jOj!20`QB_N1#0pe*q7mJXf)lC=3{eqz2Qk6l!nJIP;S?%=3z`Z71Ro^h5 z0SV!g27=JpbL^LST0!>wbhpziF^~hNXjbZJxnc3onriPWL z(H6jnz$(%m?&^qy2YNfAEdypkQlKM&Ga87e>XPXZ){)GNSy@@!oK6jkdYL27GEN|A z;4IFuqvWiT727k1O%mPKFf2vc$7xydTEgy5rp=U&46+)YEp~j)O{T&T)3I8c4LG1R z-Gh#EFDtOF$ixh}S|TTJ8OnKF)NnyyjVi$fWDHE;Ie}$_lPZID5#Mszck?;c$$rqhWiyxSxQr_rUM~(P zWof!447`CM&P%rtmDGF7z}t9-bHU7HtaL(P>!QTWd`b#&5s^!{B49XfcF-nFUJ3c* zit6GRoy#bB9Lb$IQ@r-z z)l8mct95gNJ=YUnK`CW9FAFhQ+Ci$vVQ@C_=>#B;xL>*HxqmPtWl7gvvh+Zet_ zflgH*!U#HM(QsTv8^qHKxs1(q**(K0N67*%V{=^|rpw-0E>9I)o+fl&*-TPKG9L+< zQ;7F9G24zj#+tk`$RpK11)I#}rtthVKCp`MOUFYmP2!cNJYLJ=%{<;E@#2Qcy#{rh zPadTYvv5Ho{3Kx+X{f|8)DZX0MEL-QRb(D@5xl1&^Yh={`}lyCD*62(OWa54O6q^a zGf5r)fAihBTuI`a~sB<|QFZvuO&SHRkaZGnvG9Q}}Ua5=`P zWBfhABu+AcQw-@e6EIZ*)gFBKbxs0{gzdv`%)*Cj_?>HryQ>^?*O|_Fu74o-9~hqV AIsgCw literal 0 HcmV?d00001 diff --git a/EncryptionDecryption/bin/snippet/Snippet.class b/EncryptionDecryption/bin/snippet/Snippet.class new file mode 100644 index 0000000000000000000000000000000000000000..d3e0080c42a80935678db40fc18502212b3d28ac GIT binary patch literal 262 zcmZ8by%ND-5Zud;5J7kY9SUi5jK+*AL&503#5a7INKAzHQkhYB01su{hf1@1yEk{c z&)59{U*abv(*4Sbf=nMeq}G5kV@lU9gN28JC30L}jX+63kwIL$GG~R=O}z z^I)UGe?pbX#rY7)VlARn5;|cXi*zFjrS;FW%Dp-f+Tma9nBcDRa}mqA(#PJf&QLc& r7o5wb!Av@j(P0&QG++;Is9xDH;4 org.eclipse.jdt.core.javanature + + + 1648176090490 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/FileIO/.project b/FileIO/.project index 178ff18..c38298b 100644 --- a/FileIO/.project +++ b/FileIO/.project @@ -14,4 +14,15 @@ org.eclipse.jdt.core.javanature + + + 1648176090550 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/Generics/.project b/Generics/.project index 35f7874..7efcc66 100644 --- a/Generics/.project +++ b/Generics/.project @@ -14,4 +14,15 @@ org.eclipse.jdt.core.javanature + + + 1648176090569 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/InterviewPrograms/.project b/InterviewPrograms/.project index faaf7d1..5e72962 100644 --- a/InterviewPrograms/.project +++ b/InterviewPrograms/.project @@ -14,4 +14,15 @@ org.eclipse.jdt.core.javanature + + + 1648176090588 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/JavaEnums/.project b/JavaEnums/.project index 36a5aea..a133341 100644 --- a/JavaEnums/.project +++ b/JavaEnums/.project @@ -14,4 +14,15 @@ org.eclipse.jdt.core.javanature + + + 1648176090621 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/Networking/.project b/Networking/.project index bf949aa..bebdc59 100644 --- a/Networking/.project +++ b/Networking/.project @@ -14,4 +14,15 @@ org.eclipse.jdt.core.javanature + + + 1648176090659 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/Reflections/.project b/Reflections/.project index d5dae35..7fd31bc 100644 --- a/Reflections/.project +++ b/Reflections/.project @@ -14,4 +14,15 @@ org.eclipse.jdt.core.javanature + + + 1648176090681 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/Threads/.project b/Threads/.project index 35e7365..d0a4e13 100644 --- a/Threads/.project +++ b/Threads/.project @@ -14,4 +14,15 @@ org.eclipse.jdt.core.javanature + + + 1648176090709 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + +