diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml deleted file mode 100644 index 408781c..0000000 --- a/.github/workflows/greetings.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Greetings - -on: [pull_request, issues] - -jobs: - greeting: - runs-on: ubuntu-latest - steps: - - uses: actions/first-interaction@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: 'Thanks for Figuring out'' first issue' - pr-message: 'Thanks for Your contribution'' first pull request' diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml deleted file mode 100644 index 7c724a6..0000000 --- a/.github/workflows/label.yml +++ /dev/null @@ -1,19 +0,0 @@ -# This workflow will triage pull requests and apply a label based on the -# paths that are modified in the pull request. -# -# To use this workflow, you will need to set up a .github/labeler.yml -# file with configuration. For more information, see: -# https://github.com/actions/labeler - -name: Labeler -on: [pull_request] - -jobs: - label: - - runs-on: ubuntu-latest - - steps: - - uses: actions/labeler@v2 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.gitignore b/.gitignore index 5d947ca..afbb4f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,41 @@ -# Build and Release Folders -bin-debug/ -bin-release/ -[Oo]bj/ -[Bb]in/ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ -# Other files and folders -.settings/ +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr -# Executables -*.swf -*.air -*.ipa -*.apk +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache -# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties` -# should NOT be excluded as they contain compiler settings and other important -# information for Eclipse / Flash Builder. +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store +/.idea/encodings.xml +/.idea/misc.xml +/.idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Collection/.classpath b/Collection/.classpath deleted file mode 100644 index be383cc..0000000 --- a/Collection/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/Collection/.project b/Collection/.project deleted file mode 100644 index 4a5ee8d..0000000 --- a/Collection/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - Collection - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/Collection/images/arraylist_sort.png b/Collection/images/arraylist_sort.png deleted file mode 100644 index 34d91bb..0000000 Binary files a/Collection/images/arraylist_sort.png and /dev/null differ diff --git a/Collection/images/arraylist_sort1.png b/Collection/images/arraylist_sort1.png deleted file mode 100644 index 9147b55..0000000 Binary files a/Collection/images/arraylist_sort1.png and /dev/null differ diff --git a/Collection/images/arraylist_swapping.png b/Collection/images/arraylist_swapping.png deleted file mode 100644 index aec3b60..0000000 Binary files a/Collection/images/arraylist_swapping.png and /dev/null differ diff --git a/Collection/images/asciitable.png b/Collection/images/asciitable.png deleted file mode 100644 index 45b86af..0000000 Binary files a/Collection/images/asciitable.png and /dev/null differ diff --git a/Collection/images/reverse_arrayList.png b/Collection/images/reverse_arrayList.png deleted file mode 100644 index f521694..0000000 Binary files a/Collection/images/reverse_arrayList.png and /dev/null differ diff --git a/Collection/images/subList1.png b/Collection/images/subList1.png deleted file mode 100644 index 5fe2f48..0000000 Binary files a/Collection/images/subList1.png and /dev/null differ diff --git a/Collection/images/sublid2(kmodsize).png b/Collection/images/sublid2(kmodsize).png deleted file mode 100644 index 7d6034f..0000000 Binary files a/Collection/images/sublid2(kmodsize).png and /dev/null differ diff --git a/Collection/src/Graphs/package-info.java b/Collection/src/Graphs/package-info.java deleted file mode 100644 index d1850d6..0000000 --- a/Collection/src/Graphs/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -package Graphs; \ No newline at end of file diff --git a/Collection/src/Graphs/rep.java b/Collection/src/Graphs/rep.java deleted file mode 100644 index 5d8d640..0000000 --- a/Collection/src/Graphs/rep.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - */ -package Graphs; -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class rep -{ - - static ArrayList> graph=new ArrayList>(); - - public static void main(String ...strings) - { - for(int i=0;i<5;i++) - { - graph.add(new ArrayList()); //allocates the memeory - } - - System.out.println(graph); - graph.get(0).add(1); - graph.get(0).add(4); - graph.get(1).add(3); - graph.get(1).add(4); - graph.get(1).add(0); - graph.get(2).add(1); - graph.get(2).add(3); - graph.get(3).add(1); - graph.get(3).add(4); - graph.get(4).add(3); - graph.get(4).add(0); - - - - System.out.println(graph); - } - - -} - diff --git a/Collection/src/HashMap/HashMap_to_Set.java b/Collection/src/HashMap/HashMap_to_Set.java deleted file mode 100644 index d83f84e..0000000 --- a/Collection/src/HashMap/HashMap_to_Set.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - */ -package HashMap; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class HashMap_to_Set -{ - static HashMap map; - public HashMap_to_Set(HashMap temp) - { - map=new HashMap<>(temp); - } - - public static void main(String[] args) - { - new HashMap_to_Set(new HashMaps().map); - System.out.println("HashMap :\n"+map); - - Set s=map.entrySet(); - System.out.println("SET :\n"+s); - // HashSet k=(HashSet)map.entrySet(); - //java.util.HashMap$EntrySet cannot be cast to java.util.HashSet - //at HashMap.HashMap_to_Set.main - //System.out.println(k); - } - -} diff --git a/Collection/src/HashMap/HashMaps.java b/Collection/src/HashMap/HashMaps.java deleted file mode 100644 index fc95189..0000000 --- a/Collection/src/HashMap/HashMaps.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - */ -package HashMap; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class HashMaps -{ static Scanner nav; - HashMap map; - public HashMaps() - { - nav=new Scanner(System.in); - map= new HashMap(); - insert_to_Map(); - } - - public void insert_to_Map() - { - //map.entrySet(1,"NAVEEN"); - map.put(1,"NAVEEN"); - map.put(2,"bala"); - map.put(1,"james");//over writes the naveen - map.put(0,"praveen"); - map.put(105,"RDJ"); - } - public static void main(String[] args) - { - HashMaps obj =new HashMaps(); - for(Map.Entry x:obj.map.entrySet()) - System.out.println(x.getKey()+" "+x.getValue()); - } - -} diff --git a/Collection/src/HashMap/KeySet_HashMap.java b/Collection/src/HashMap/KeySet_HashMap.java deleted file mode 100644 index 6fa7d89..0000000 --- a/Collection/src/HashMap/KeySet_HashMap.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - */ -package HashMap; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class KeySet_HashMap -{ static HashMap map; - public KeySet_HashMap(HashMap map) - { - this.map=new HashMap(map); - } - - public static void main(String[] args) - { - new KeySet_HashMap(new HashMaps().map) ; - System.out.println("HASHMAP :"+map); - Set s=map.keySet(); - System.out.println("Key in hashMap-->map :"+s); - } - -} diff --git a/Collection/src/HashMap/clone_hashmap.java b/Collection/src/HashMap/clone_hashmap.java deleted file mode 100644 index 1c63618..0000000 --- a/Collection/src/HashMap/clone_hashmap.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - */ -package HashMap; -import java.util.HashMap; - -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class clone_hashmap { - static HashMap map; - public clone_hashmap() - { - map=new HashMap (); - } - public static void main(String[] args) - { - new clone_hashmap() ; - map.putAll(new HashMaps().map);// new HashMaps().map must match map - System.out.println("Displaying the HaSHMAP :"+map); - HashMap temp=new HashMap(map); - HashMap temp2=new HashMap(map); - System.out.println("Displaying the HaSHMAP :"+temp); - System.out.println("Displaying the HaSHMAP :"+temp2); - // HashMap c=map.clone(); Type mismatch: cannot convert from Object to HashMap - HashMap c=(HashMap)map.clone(); - HashMap c1=(HashMap)map.clone(); - System.out.println("Displaying the HaSHMAP using Clone :"+c); - System.out.println("Displaying the HaSHMAP using Clone :"+c1); - } - -} diff --git a/Collection/src/HashMap/collection_view_values.java b/Collection/src/HashMap/collection_view_values.java deleted file mode 100644 index acdac8d..0000000 --- a/Collection/src/HashMap/collection_view_values.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - */ -package HashMap; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class collection_view_values -{ - static HashMap map; - public collection_view_values(HashMap map) - {this.map=new HashMap(map); - } - - public static void main(String[] args) - { - new collection_view_values(new HashMaps().map); - System.out.println("Hash Map :"+map); - System.out.println("collection of values"+map.values()); - //ArrayList list= (ArrayList)map.values(); - //System.out.println("collection of values"+map.values()); output-java.util.HashMap$Values cannot be cast to java.util.ArrayList - //at HashMap.collection_view_values.main(collection_view_values.java:23) - ArrayList list= new ArrayList(map.values()); - System.out.println("ArrayList of values"+list); - } - -} diff --git a/Collection/src/HashMap/get_value.java b/Collection/src/HashMap/get_value.java deleted file mode 100644 index af598ac..0000000 --- a/Collection/src/HashMap/get_value.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - */ -package HashMap; -import java.util.*; -import java.util.HashMap; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class get_value -{ static Scanner nav=new Scanner(System.in); - static HashMap h; - public get_value(HashMap temp) - { - h=new HashMap (temp); - } - - public static void main(String[] args) - { - new get_value(new HashMaps().map); - System.out.println("HASH MAP :"+h); - System.out.print("Enter the key :"); - int ele=nav.nextInt(); - if(h.containsKey(ele)) - { - System.out.println("value exists!!="+h.get(ele)); - } - else - { System.out.println("value Doesnot exists!!=");//h.get(ele)=null - } - - } - -} diff --git a/Collection/src/HashMap/hashmap_count_size.java b/Collection/src/HashMap/hashmap_count_size.java deleted file mode 100644 index b9d050e..0000000 --- a/Collection/src/HashMap/hashmap_count_size.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - */ -package HashMap; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class hashmap_count_size -{ - static HashMap map; - public hashmap_count_size() - { - map= new HashMap(); - } - - public static void main(String[] args) - { new hashmap_count_size(); - map.put(-1,"10"); - map.put(-2,"9"); - map.put(-3,"8"); - - System.out.print("SIze of HashMap :"+map.size()); - } - -} diff --git a/Collection/src/HashMap/package-info.java b/Collection/src/HashMap/package-info.java deleted file mode 100644 index c5daf3e..0000000 --- a/Collection/src/HashMap/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -package HashMap; \ No newline at end of file diff --git a/Collection/src/HashMap/remove_all_mapping.java b/Collection/src/HashMap/remove_all_mapping.java deleted file mode 100644 index 045d676..0000000 --- a/Collection/src/HashMap/remove_all_mapping.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - */ -package HashMap; -import java.util.HashMap; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class remove_all_mapping { - static HashMap h; - public remove_all_mapping() - { - h=new HashMap<>(); - } - - public static void main(String[] args) - { - new remove_all_mapping (); - h.putAll(new HashMaps().map); - System.out.println("Mapping "+h); - h.remove(0); - System.out.println("Mapping After removing Key-0 :"+h); - h.clear(); - System.out.println("Mapping After removing all Keys :"+h); - - } - -} diff --git a/Collection/src/HashMap/search.java b/Collection/src/HashMap/search.java deleted file mode 100644 index 682c857..0000000 --- a/Collection/src/HashMap/search.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - */ -package HashMap; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class search { - static HashMap map; - static Scanner nav; - public search() - { nav=new Scanner(System.in); - map=new HashMap(); - } - - public static void main(String[] args) - { new search(); - map.put(1,"red"); - map.put(2,"blue"); - map.put(3,"yellow"); - System.out.println("HashMap :"+map); - System.out.println("Enter to check if the Key is present :"); - if(map.containsKey(nav.nextInt())) - System.out.println("Is present"); - else - System.out.println("Not present"); - System.out.println("Enter to check if the Value is present :"); - if(map.containsValue(nav.next())) //if nav.nextInt() the output is "Value Not present" - { - System.out.println("Is present"); - } - else - System.out.println("Value Not present"); - } - -} diff --git a/Collection/src/Hashset/append_hashset.java b/Collection/src/Hashset/append_hashset.java deleted file mode 100644 index 52e2850..0000000 --- a/Collection/src/Hashset/append_hashset.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - */ -package Hashset; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class append_hashset -{ - static HashSet h; - - public append_hashset() - { - h= new HashSet<>(); - } - - public static void main(String ... arg) - { //HashSet is faster but doesnot maintain any order - System.out.println("IMPLEMENTING HASHSET"); - new append_hashset(); - int a[]={1,2,3,1,4,5,5,7,8,9,1,5,6,0,20,9,0,100,56}; - System.out.println("Displaying the array -"+Arrays.toString(a)); - for(int i=0;i"+h); //h.size<=a.length always . - } -} diff --git a/Collection/src/Hashset/common_element.java b/Collection/src/Hashset/common_element.java deleted file mode 100644 index 21b1043..0000000 --- a/Collection/src/Hashset/common_element.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - */ -package Hashset; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ - -public class common_element -{ - static HashSet h1; - static HashSet h2; - public common_element () - { - h1=new HashSet(); - h2=new HashSet(); - } - - public static void main(String[] args) - { - new common_element(); - h1.add("Life") ; - h1.add("My"); - h1.add("Pie"); - System.out.println("Displaying HashSet h1"+h1); - h2.add("My"); - h2.add("my"); - h2.add("Pie"); - h2.add("red"); - System.out.println("Displaying HashSet h2"+h2); - System.out.println("Common Element :"); - h1.retainAll(h2); - System.out.println("After retaining HashSet h1 :"+h1); - } - -} diff --git a/Collection/src/Hashset/compare_hashset.java b/Collection/src/Hashset/compare_hashset.java deleted file mode 100644 index 42c4d72..0000000 --- a/Collection/src/Hashset/compare_hashset.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - */ -package Hashset; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class compare_hashset -{ - static HashSet h1; - static HashSet h2; - public compare_hashset() - { - h1=new HashSet(); - h2=new HashSet(); - } - - public static void main(String[] args) - { - new compare_hashset(); - h1.add("Life") ; - h1.add("My"); - h1.add("Pie"); - System.out.println("Displaying HashSet h1"+h1); - h2.add("My"); - h2.add("my"); - h2.add("Pie"); - h2.add("red"); - System.out.println("Displaying HashSet h2"+h2); - for(String temp:h2) - { - System.out.println((h1.contains(temp)?"Yes":"No")); - } - } - -} diff --git a/Collection/src/Hashset/covert_to_list.java b/Collection/src/Hashset/covert_to_list.java deleted file mode 100644 index 3c6ae0b..0000000 --- a/Collection/src/Hashset/covert_to_list.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - */ -package Hashset; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class covert_to_list -{ - static HashSet h; - public covert_to_list() - { - h= new HashSet(); - } - public static void addition() - { - int a[]={1,2,1,3,0,5,0,5,6,1,6,7,5,7,5,8,9}; - for(int i=0;i l=new ArrayList(h); - LinkedList L=new LinkedList(h); - System.out.println("ArrayList :"+l+"\nLinkedList :"+L); - } - -} diff --git a/Collection/src/Hashset/covert_to_treeset.java b/Collection/src/Hashset/covert_to_treeset.java deleted file mode 100644 index 109ec22..0000000 --- a/Collection/src/Hashset/covert_to_treeset.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - */ -package Hashset; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class covert_to_treeset -{ - static HashSet h; - public covert_to_treeset() - { - h=new HashSet(); - } - public static void addition() - { - int a[]={1,2,1,3,0,5,0,5,6,1,6,7,5,7,5,8,9}; - for(int i=0;i t=new TreeSet(h); - for(Integer tree:t) - System.out.println(" "+tree); - - - } - -} diff --git a/Collection/src/Hashset/display_hashset.java b/Collection/src/Hashset/display_hashset.java deleted file mode 100644 index a4c95c5..0000000 --- a/Collection/src/Hashset/display_hashset.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - */ -package Hashset; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class display_hashset -{ - static HashSet h; - public display_hashset() - { - h=new HashSet(); - } - public static void addition() - { - int a[]={1,2,1,3,0,5,0,5,6,1,6,7,5,7,5,8,9}; - for(int i=0;i h; - public hashset_array() - { - h=new HashSet(); - } - public static void addition() - { - int a[]={0,0,0,3,3,3,1,2,1,4,6,5,7,8,8,9,9,9}; - for(int i=0;i h1; - public remove() - { - h1=new HashSet(); - } - - public static void main(String[] args) - { - new remove(); - h1.add("Life") ; - h1.add("My"); - h1.add("Pie"); - System.out.println("Displaying HashSet h1"+h1); - h1.remove("Life"); - System.out.println("After Removing HashSet h1"+h1); - } - -} diff --git a/Collection/src/PriorityQueue/package-info.java b/Collection/src/PriorityQueue/package-info.java deleted file mode 100644 index 5b626a0..0000000 --- a/Collection/src/PriorityQueue/package-info.java +++ /dev/null @@ -1,16 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -package PriorityQueue; -//PriorityQueue doesn’t permit null. -/* - * PriorityQueue are unbound queues. - * PriorityQueue(int initialCapacity): - * Creates a PriorityQueue with the specified initial capacity that - * orders its elements according to their natural ordering. - */ diff --git a/Collection/src/TREES/TressDemo.java b/Collection/src/TREES/TressDemo.java deleted file mode 100644 index 1a510d9..0000000 --- a/Collection/src/TREES/TressDemo.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * - */ -package TREES; -import java.util.*; - -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class TressDemo -{ - static Scanner nav =new Scanner(System.in); - - static class node { - node left,right; - int data; - - node (int data){this.data =data;} - } - public static node createTree() - { node root =null; - System.out.println("Enter the Data :"); - int data=nav.nextInt(); - if(data==-1) { - return null; - } - - root =new node(data); - System.out.println("The data entered on Left :"+data); - root.left =createTree(); - System.out.println("The data entered on Right :"+data); - root.right=createTree(); - - - return root; - - } - - public static void inOrder(node root) - { - if(root ==null) {return ;} - - inOrder(root.left); - System.out.print(root.data +" "); - inOrder(root.right); - } - - public static void PerOrder(node root) - { - if(root ==null) {return ;} - System.out.print(root.data +" "); - PerOrder(root.left); - - PerOrder(root.right); - } - - public static void PostOrder(node root) - { - if(root ==null) {return ;} - - PostOrder(root.left); - - PostOrder(root.right); - System.out.print(root.data +" "); - } - - public static void main(String[] args) - { - System.out.println("Tree"); - node root =createTree(); - System.out.println("Inorder !!!!"); - inOrder(root); - - System.out.println("\nPostorder !!!!"); - PostOrder(root); - System.out.println("\nPreOrder !!!!"); - PerOrder(root); - } - -} - diff --git a/Collection/src/TREES/package-info.java b/Collection/src/TREES/package-info.java deleted file mode 100644 index b25f6f6..0000000 --- a/Collection/src/TREES/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -package TREES; \ No newline at end of file diff --git a/Collection/src/TreeSet/Clone_treeset.java b/Collection/src/TreeSet/Clone_treeset.java deleted file mode 100644 index a8a4c0f..0000000 --- a/Collection/src/TreeSet/Clone_treeset.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - */ -package TreeSet; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class Clone_treeset -{ static TreeSet t; - public Clone_treeset() - { - t=new TreeSet(); - } - - public static void main(String[] args) - { - System.out.println ("Implementing TreeSet :"); - new Clone_treeset() ; - int a[]={1,2,3,4,5,6,7,8,9,0,0,1,50}; - for(int c:a) - t.add(c); - System.out.println(" Displaying the TreeSet \n"+t); - //TreeSet t2=t.clone(); error can not convert object to treeset - TreeSet t2=(TreeSet) t.clone(); - System.out.println(" Displaying the TreeSet \n"+t2); - } - -} diff --git a/Collection/src/TreeSet/Display_treeSet.java b/Collection/src/TreeSet/Display_treeSet.java deleted file mode 100644 index bb32974..0000000 --- a/Collection/src/TreeSet/Display_treeSet.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - */ -package TreeSet; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class Display_treeSet -{ - static TreeSet t; - static TreeSet t1; - public Display_treeSet() - { - t=new TreeSet(); - t1=new TreeSet(); - } - - public static void main(String[] args) - { - new Display_treeSet (); - int a[]={1,2,3,4,5,6,7,8,9,0,50}; - for(int c:a) - t.add(c); - System.out.print("Integer Tree :"); - for(Integer c:t) - System.out.print(" "+c); - for(int c:a) - t1.add(""+c); - System.out.print("\nString Tree :"); - for(String c:t1) - System.out.print(" "+c); - } - -} diff --git a/Collection/src/TreeSet/Greater_than_equal.java b/Collection/src/TreeSet/Greater_than_equal.java deleted file mode 100644 index ce3af89..0000000 --- a/Collection/src/TreeSet/Greater_than_equal.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - */ -package TreeSet; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class Greater_than_equal -{ - static TreeSet t; - static TreeSet t2; - static Scanner nav; - public Greater_than_equal() - { - t=new TreeSet(); - nav=new Scanner(System.in); - } - - public static void main(String[] args) - { - System.out.println ("Implementing TreeSet :"); - new Greater_than_equal(); - int a[]={1,4,6,8,10,15,20,44,0,0,1,50}; - for(int c:a) - t.add(c); - System.out.println(" Displaying the TreeSet \n"+t); - System.out.println("Enter the number x to get number Greater than equal to Number:"); - System.out.println(t.ceiling(nav.nextInt())); - - } - -} diff --git a/Collection/src/TreeSet/Tree.java b/Collection/src/TreeSet/Tree.java deleted file mode 100644 index 9d77585..0000000 --- a/Collection/src/TreeSet/Tree.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Tree set maintain \s sorted order (asc). - */ -package TreeSet; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class Tree -{ - static TreeSet t; - public Tree() - { - t=new TreeSet(); - } - - public static void main(String[] args) - { - new Tree(); - addition(); - } - - /** - * - */ - private static void addition() - { - int a[]={0,0,3,5,8,9,8,7,100,9}; - for(int i=0;it; - static TreeSet t2; - static TreeSet t3; - public add_to_tree() - { - t=new TreeSet(); - t2=new TreeSet(t); - t3=new TreeSet(); - } - - public static void main(String[] args) - { - new add_to_tree (); - int a[]={1,2,3,4,5,6,7,8,9,0,50}; - for(int c:a) - t.add(c); - System.out.println("Integer Tree T1:"+t); //mutiple wasy to add elemts to another TreeSet - t2=new TreeSet(t); - System.out.println("INTEGER TREE T2:"+t2); - t3.addAll(t2); - System.out.println("INTEGER TREE T3:"+t3); - } - -} diff --git a/Collection/src/TreeSet/getelement_tree.java b/Collection/src/TreeSet/getelement_tree.java deleted file mode 100644 index 9143cd7..0000000 --- a/Collection/src/TreeSet/getelement_tree.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - */ -package TreeSet; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class getelement_tree -{ - static TreeSet t; - public getelement_tree() - { - t=new TreeSet(); - } - - public static void main(String[] args) - { - - System.out.println ("Implementing TreeSet :"); - new getelement_tree() ; - int a[]={1,2,3,4,5,6,7,8,9,0,0,1,50}; - for(int c:a) - t.add(c); - System.out.println(" Displaying the TreeSet \n"+t); - System.out.println("Root:"+t.first()); - System.out.println("Last element:"+t.last()); - - } - -} diff --git a/Collection/src/TreeSet/less_than.java b/Collection/src/TreeSet/less_than.java deleted file mode 100644 index f66fd99..0000000 --- a/Collection/src/TreeSet/less_than.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - */ -package TreeSet; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class less_than -{ static Scanner nav; - static TreeSet t; - public less_than() - { nav=new Scanner(System.in); - t=new TreeSet(); - } - - public static void main(String[] args) - { - System.out.println ("Implementing TreeSet :"); - new less_than(); - int a[]={1,4,6,8,10,15,20,44,0,0,1,50}; - for(int c:a) - t.add(c); - System.out.println(" Displaying the TreeSet \n"+t); - System.out.println("Enter the number x to get number Lesser than to Number:"); - // lesser than only not lesser than equal to eq is number is x=10 then output is :8 - System.out.println(t.lower(nav.nextInt())); - // if x=0,the output is null. - } - -} diff --git a/Collection/src/TreeSet/less_than_num.java b/Collection/src/TreeSet/less_than_num.java deleted file mode 100644 index c6afffe..0000000 --- a/Collection/src/TreeSet/less_than_num.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - */ -package TreeSet; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class less_than_num -{ - static TreeSet t; - static TreeSet temp; - static Scanner nav; - public less_than_num() - { - t=new TreeSet(); - temp=new TreeSet(); - nav=new Scanner(System.in); - } - - public static void main(String[] args) - { - System.out.println ("Implementing TreeSet :"); - new less_than_num() ; - int a[]={1,2,3,4,5,6,7,8,9,0,0,1,50}; - for(int c:a) - t.add(c); - System.out.println(" Displaying the TreeSet \n"+t); - System.out.println("Enter the number x:"); - temp=(TreeSet)t.headSet(nav.nextInt()); - System.out.print("Number's less x in Treeset t :"+temp); - } - -} diff --git a/Collection/src/TreeSet/package-info.java b/Collection/src/TreeSet/package-info.java deleted file mode 100644 index 3fe9e67..0000000 --- a/Collection/src/TreeSet/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -package TreeSet; -/*TreeSet maintains an object in sorted order - * HashSet allows null object. TreeSet doesn’t allow null Object and throw NullPointerException, - * Why, because TreeSet uses compareTo() method to compare keys and - * compareTo() will throw java.lang.NullPointerException. - * If you want a sorted Set then it is better to add elements to HashSet - * and then convert it into TreeSet rather than creating a TreeSet and adding elements to it. - * url=https://stackoverflow.com/questions/1463284/hashset-vs-treeset - * - */ diff --git a/Collection/src/TreeSet/remove_last.java b/Collection/src/TreeSet/remove_last.java deleted file mode 100644 index 52f23a6..0000000 --- a/Collection/src/TreeSet/remove_last.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - */ -package TreeSet; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class remove_last -{ - static TreeSet t; - static Scanner nav; - public remove_last() - { nav=new Scanner(System.in); - t=new TreeSet(); - } - - public static void main(String[] args) - { - new remove_last(); - for(int i=0;i<20;i=i+3) - t.add(i); - System.out.println("Displaying TreeSet :"+t); - System.out.println("Removing the lastelement from TreeSet: "+t.pollLast()); - System.out.println("Remove the First element from TreeSet: "+t.pollFirst()); - System.out.println("Remove a element from TreeSet"); - t.remove(nav.nextInt()); - System.out.println("After removing TreeSet T :"+t); - } - -} diff --git a/Collection/src/TreeSet/reverse_treeset.java b/Collection/src/TreeSet/reverse_treeset.java deleted file mode 100644 index 3aff6af..0000000 --- a/Collection/src/TreeSet/reverse_treeset.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - */ -package TreeSet; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class reverse_treeset -{ - static TreeSet t; - public reverse_treeset() - { - t=new TreeSet(); - } - - public static void main(String[] args) - { - System.out.println ("Implementing TreeSet :"); - new reverse_treeset(); - int a[]={1,2,3,4,5,6,7,8,9,0,0,1,50}; - for(int c:a) - t.add(c); - System.out.println(" Displaying the TreeSet \n"+t); - Iterator i=t.descendingIterator(); - System.out.println(" Displaying Reverse TreeSet"); - while(i.hasNext()) - System.out.print(" "+i.next()); - } - -} diff --git a/Collection/src/arrayslists/arrayList_intersection.java b/Collection/src/arrayslists/arrayList_intersection.java deleted file mode 100644 index 76fcd81..0000000 --- a/Collection/src/arrayslists/arrayList_intersection.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * - */ -package arrayslists; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class arrayList_intersection -{ - ArrayList n1,n2; - public arrayList_intersection() - { - n1=new ArrayList(); - n2=new ArrayList(); - } - - public ArrayList intersect(ArrayList n1,ArrayList n2) - { - ArrayList intersect=new ArrayList(); - for(Object s:n1) - { - //intersect.add(n2.contains(s)?s:null); output --> Intersection of 2 arrayList-[null, Red, null, null, 5] - if(n2.contains(s)) - { - intersect.add(s); - } - } - - - return intersect; - } - public void add() - { - n1.add("white"); - n1.add("Red"); - n1.add("Black"); - n1.add(100); - n1.add(5); - - n2.add("White"); - n2.add("Red"); - n2.add("100"); - n2.add(5); - } - public static void main(String ...nav) - { - arrayList_intersection list =new arrayList_intersection(); - list.add(); - System.out.println("Intersection of 2 arrayList-"+list.intersect(list.n1, list.n2)); - } -} diff --git a/Collection/src/arrayslists/arrayList_union.java b/Collection/src/arrayslists/arrayList_union.java deleted file mode 100644 index bdf20e0..0000000 --- a/Collection/src/arrayslists/arrayList_union.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - */ -package arrayslists; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class arrayList_union -{ - private ArrayList n1,n2; - public arrayList_union() - {n1=new ArrayList(); - n2=new ArrayList(); - - } - public ArrayList union(ArrayList n1,ArrayList n2) - { - ArrayList n3=new ArrayList(); - for(Object temp:n1) - { - - n3.add(temp); - - } - for(Object temp:n2) - { - if(n1.contains(temp)) - {} - else - { - n3.add(temp); - } - - } - return n3; - } - public void add() - { - n1.add("white"); - n1.add("Red"); - n1.add("Black"); - n1.add(100); - n1.add(5); - n1.add("NAVEEN"); - - n2.add("White"); - n2.add("Red"); - n2.add("NAVEEN"); - n2.add(125.05f); - n2.add(5); - } - public static void main(String[] args) - { - arrayList_union list =new arrayList_union (); - list.add(); - System.out.println("ArrayList Union-"+list.union(list.n1, list.n2)); - - } - -} diff --git a/Collection/src/arrayslists/array_list.java b/Collection/src/arrayslists/array_list.java deleted file mode 100644 index 6eba3d3..0000000 --- a/Collection/src/arrayslists/array_list.java +++ /dev/null @@ -1,40 +0,0 @@ -package arrayslists; -import java.util.*; -public class array_list -{ - static ArrayList n=new ArrayList<>(); - static ArrayList n1=new ArrayList(); - public static void main(String ...arg) - { - n.add("red"); //red is object. - n.add("yellow"); - n.add("green"); - n.add(3343); - n1.add(25); - n1.add(100); - n1.add("1515"); - for(Object s:n) - { - System.out.println(s); - System.out.println(s.toString()); - } - //ArrayList i=n.iterator(); error interator cannot be converted to arraylist - Iterator i=n.iterator(); - for(;i.hasNext();) - { - System.out.print(i.next()+","); - - } - /*while(i.hasNext()) - { - System.out.println(i.next()); will not print anything because i is next=null - - }*/ - Iterator n1=n.iterator(); - while(n1.hasNext()) - { - System.out.println(n1.next()+"..."); - } - } -} - diff --git a/Collection/src/arrayslists/arraylist.java b/Collection/src/arrayslists/arraylist.java deleted file mode 100644 index daa4ea4..0000000 --- a/Collection/src/arrayslists/arraylist.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * - */ -package arrayslists; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class arraylist -{ - ArrayList d; - ArrayList str; - ArrayList df; - ArrayList f; - ArrayList obj; - //ArrayList b; - ArrayList c; - - public arraylist() - { - d=new ArrayList<>(); - str=new ArrayList<>(); - df=new ArrayList<>(); - f=new ArrayList<>(); - obj=new ArrayList<>(); - //b=new ArrayList<>(); - c=new ArrayList<>(); - addition(); - } - public void addition() - { - for(int i=1;i<=10;i++) - d.add(i); - for(float i=1;i<10;i++) - { - f.add(i); - } - for(double i=1;i<10;i++) - { - df.add(i); - } - String s="NAVEEN IS VITIAN IRONMAN HULK AND THOR LOKI"; - String st[]=s.split(" "); - char ch[]=s.toCharArray(); - for(char x:ch) - c.add(x); - for(String i:st) - str.add(i); - obj.addAll(d); - obj.addAll(f); - obj.addAll(df); - obj.addAll(c); - obj.addAll(str); - - - //for(String i:st) - // str.add(i); - - } - public static void main(String ...arg) - { - arraylist n=new arraylist(); - System.out.println(n.obj); - } -} - diff --git a/Collection/src/arrayslists/arraylist_iterator.java b/Collection/src/arrayslists/arraylist_iterator.java deleted file mode 100644 index 78843e9..0000000 --- a/Collection/src/arrayslists/arraylist_iterator.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - */ -package arrayslists; -import java.util.*; -/** - * @author M.NAVEEN - * - */ -public class arraylist_iterator -{ static ArrayList n=new ArrayList<>(); - static ArrayList n1=new ArrayList(); - static ArrayList n2=new ArrayList<>(3);//inital capacity of ArrayList is 3 //ArrayList doesnot have capacity method to know the capacity unlike stack - public static void main(String[] args) - { - n.add("TONY"); - n.add("VIRAT"); - n.add("KARAN"); - /* for(String ele:n) error beause arraylist is not String type but object type - { - - }*/ - for(Object s:n) - { - System.out.println(s); - //System.out.println(s.toString()); - } - - n1.add("MK"); - n1.add("VK"); - n1.add("RS"); - - for(String ele:n1) - { - System.out.println(ele); - } - n2.add(100); - n2.add(52); - n2.add(85); - n2.add(565); - - for(Integer y:n2) - { - System.out.println(y); - } - System.out.println(n2); - } - } - - - diff --git a/Collection/src/arrayslists/arraylist_join.java b/Collection/src/arrayslists/arraylist_join.java deleted file mode 100644 index 092afc8..0000000 --- a/Collection/src/arrayslists/arraylist_join.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - */ -package arrayslists; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class arraylist_join -{ - private ArrayList n1,n2; - public arraylist_join() - { - n1=new ArrayList (); - n2=new ArrayList(); - } -public ArrayList join(ArrayList n1,ArrayList n2) -{ - ArrayList join =new ArrayList (); - join.addAll(n1); - join.addAll(n2); - return join; -} - -public void add() -{ - n1.add(1); - n1.add(5); - n1.add("red"); - n1.add("Black"); - System.out.println("First arrayList -"+n1); - n2.add("Black"); - n2.add("white"); - n2.add(5); - System.out.println("Second arrayList -"+n2); - -} -public static void main(String ...arg) -{ - arraylist_join list=new arraylist_join(); - list.add(); - System.out.println("After joining n1&n2 -"+list.join(list.n1, list.n2)); -} -} diff --git a/Collection/src/arrayslists/arraylist_print.java b/Collection/src/arrayslists/arraylist_print.java deleted file mode 100644 index aea0ad2..0000000 --- a/Collection/src/arrayslists/arraylist_print.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - */ -package arrayslists; - -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class arraylist_print extends arraylist -{ - - /** - * To print based on position - */ - public arraylist_print() - { - super(); - } - public static void main(String ...arg) - { - arraylist_print s=new arraylist_print(); - for(int i=0;in =new ArrayList<>(); - private static ArrayList n2=new ArrayList<>(); - public static void main(String[] args) - { - n.add(155); - n.add(010); //since its is 010 java will consider it as octal so it is converted in decimal value 0*8^2+1*8^1 + 0*8^0= 8 - n.add(4854.256); - n.add("NAVEEN"); - // arraylist element ->>> 155->010 - System.out.println(n.getClass());// Print's class name - System.out.println(n.get(0));//get(int index); - System.out.println(n.get(1)); - - n2.add(0101); - System.out.println(n2.get(0)); //since its is 010 java will consider it as octal so it is converted in decimal value 0*8^3+1*8^2+0*8^1 + 1*8^0= 64+1=65 - - } - -} diff --git a/Collection/src/arrayslists/increase_size_arlist.java b/Collection/src/arrayslists/increase_size_arlist.java deleted file mode 100644 index 248b45d..0000000 --- a/Collection/src/arrayslists/increase_size_arlist.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - */ -package arrayslists; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class increase_size_arlist extends arraylist -{ - - public increase_size_arlist() - { - super(); - } - public static void main(String ...naveen) - { - new increase_size_arlist().str.ensureCapacity(100); //increases the capacity to 100 - - } - -} diff --git a/Collection/src/arrayslists/insertfirst.java b/Collection/src/arrayslists/insertfirst.java deleted file mode 100644 index 64f55b9..0000000 --- a/Collection/src/arrayslists/insertfirst.java +++ /dev/null @@ -1,32 +0,0 @@ -package arrayslists; -import java.util.*; -public class insertfirst -{ static ArrayList n=new ArrayList<>(); - public static void main(String ...arg) - { - n.add(12.5); - n.add(100.0); - for(Double x:n) - { - System.out.print(x+" "); - - - } - System.out.println(); - n=new ArrayList<>(10); - n.add(12.5); - n.add(100.0); - for(Double x:n) - { - System.out.print(x); - - }System.out.println(); - n.add(0,10.01); - n.add(0,2.0); - n.add(4,5.55);// n.add(10,5556.66) error because size only 4 so it must be lesser than =4 - for(Double x:n) - { - System.out.println(x); - } - } -} diff --git a/Collection/src/arrayslists/remove_element.java b/Collection/src/arrayslists/remove_element.java deleted file mode 100644 index 65d2e3e..0000000 --- a/Collection/src/arrayslists/remove_element.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * - */ -package arrayslists; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class remove_element -{ - static ArrayList n=new ArrayList<>(); - public static void main(String ...arg) - { - n.add(100); - n.add("teams"); - n.add("Teamlink"); - n.add("red"); - n.add(100.0f); - System.out.println("before remove"+n+"size of arraylist-"+n.size()); - n.remove(0); - n.remove(2); - System.out.println("After removing"+n+"size of arraylist-"+n.size()); - } - -} diff --git a/Collection/src/arrayslists/replace_arraylist.java b/Collection/src/arrayslists/replace_arraylist.java deleted file mode 100644 index ac5619f..0000000 --- a/Collection/src/arrayslists/replace_arraylist.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - */ -package arrayslists; - -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class replace_arraylist extends arraylist -{ - public replace_arraylist() - { - super(); - } - public void replace() - { - System.out.println("Initial Arraylist d -"+d); - - for(int i=10,j=0;i>=1;i--,j++) //using set method-set(index,value) - d.set(j,i); - System.out.println("After replacing Arraylist d -"+d); - } - public static void main(String[] args) - { - new replace_arraylist().replace(); - } - -} diff --git a/Collection/src/arrayslists/reverse_arrayList.java b/Collection/src/arrayslists/reverse_arrayList.java deleted file mode 100644 index 34f0973..0000000 --- a/Collection/src/arrayslists/reverse_arrayList.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - */ -package arrayslists; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class reverse_arrayList -{ //static int reverse; - static ArrayList n; - public reverse_arrayList() - { - n=new ArrayList<>(); - } - - public static ArrayList reverse() - { - Collections.reverse(n); - return n; - } - public static void main(String ...nav) - { - reverse_arrayList obj=new reverse_arrayList(); - obj.adds(); - System.out.println("reverse of a arrayList"+reverse().toString()); - } - - /** - * - */ - private void adds() - { - n.add(100); - n.add("NAVEEN"); - n.add(1452.0); - n.add(15); - System.out.println("ArrayList ="+n); - } - -} diff --git a/Collection/src/arrayslists/search_arraylist.java b/Collection/src/arrayslists/search_arraylist.java deleted file mode 100644 index 828f13a..0000000 --- a/Collection/src/arrayslists/search_arraylist.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * - */ -package arrayslists; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class search_arraylist -{ private static ArrayList n=new ArrayList (); - - public static void main(String[] args) - { - n.add("naveen"); - n.add("10100"); - n.add(154); - n.add(78547); - n.add(80); - - if(n.contains(80)) - { - System.out.println("The element is present in ArrayList"); - } - else - { - System.out.println("The element Not is present in ArrayList"); - } - - if(n.contains("naveen")) - { - System.out.println("The element is present in ArrayList"); - } - else - { - System.out.println("The element Not is present in ArrayList"); - } - if(n.contains(155)) - { - System.out.println("The element is present in ArrayList"); - } - else - { - System.out.println("The element Not is present in ArrayList"); - } - } - -} diff --git a/Collection/src/arrayslists/shuffle_elements.java b/Collection/src/arrayslists/shuffle_elements.java deleted file mode 100644 index a7f2e8f..0000000 --- a/Collection/src/arrayslists/shuffle_elements.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - */ -package arrayslists; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class shuffle_elements -{ - static ArrayList n; - public shuffle_elements() - { - n=new ArrayList <>(); - - } - - public static void main(String[] args) - { - shuffle_elements n1=new shuffle_elements(); - n.add("RED"); - n.add("WHITE"); - n.add("BLACK"); - n.add("YELLOW"); - n.add("Orange"); - n.add("BLUE"); - - System.out.println("Before shuffle ="+n); - Collections.shuffle(n); - System.out.println("After shuffle ="+n); - - } - -} diff --git a/Collection/src/arrayslists/sort_arraylist.java b/Collection/src/arrayslists/sort_arraylist.java deleted file mode 100644 index 3f820a8..0000000 --- a/Collection/src/arrayslists/sort_arraylist.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - */ -package arrayslists; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class sort_arraylist -{ - private static ArrayList n=new ArrayList<>(); - private static ArrayList str=new ArrayList<>(); - private static ArrayList str2=new ArrayList<>(); - public static void main(String[] args) - { - System.out.println("when arrayList is generic"); - n.add(45); //even throught arraylist is static you need object to add - n.add(485); - n.add(1); - n.add(25); - System.out.println("Before sorting -"+n); - Collections.sort(n); - System.out.println("After sorting -"+n); - //Array sorting depends ASCII keys of character - System.out.println("when arrayList is generic"); - //sorting rules String type arraylist are 1>it will check 1st character of each String object if number then first ,if character then after all number.then 1st to UpperCases Character - str.add("45"); - str.add("1200"); - str.add("1.1"); - str.add("5.5"); - str.add("red"); - str.add("blue"); - str.add("apple"); - str.add("thor"); - str.add("Red");// if both u same Red=REd then REd will be printed first because of Uppercase - str.add("REd");//because of ASCII KEY VALUES EG-A d; - LinkedList f; - LinkedList df; - LinkedList str; - LinkedList c; - LinkedList obj; - public abstract_linkedlist() - { - d= new LinkedList(); - f=new LinkedList(); - df=new LinkedList(); - str=new LinkedList(); - c=new LinkedList(); - obj=new LinkedList(); - - } - protected abstract void add(); - public abstract void display(); - - public static void main(String ...arg) - { - System.out.println("This abstract class of LinkedList "); - } - -} diff --git a/Collection/src/linkedlist/compare_linkedlist.java b/Collection/src/linkedlist/compare_linkedlist.java deleted file mode 100644 index dbd2310..0000000 --- a/Collection/src/linkedlist/compare_linkedlist.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - */ -package linkedlist; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class compare_linkedlist -{ static linkedlist l; - public compare_linkedlist() - { - // super(); no need - l=new linkedlist(); - } - - public static void main(String[] args) - { - System.out.println("Comparing Two LinkedList"); - new compare_linkedlist(); - l.add(); - LinkedList x=new LinkedList <>(); - for(Object s:l.d) - { - System.out.print((l.df.contains(s)==true)?"yes ":"no "); - if(l.df.contains(s)==false) - x.add(s); - - } - System.out.print("\n"+x); - } - -} diff --git a/Collection/src/linkedlist/intersection_removeall.java b/Collection/src/linkedlist/intersection_removeall.java deleted file mode 100644 index 9afde91..0000000 --- a/Collection/src/linkedlist/intersection_removeall.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - */ -package linkedlist; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class intersection_removeall -{ - linkedlist list; - public intersection_removeall() - { super(); - list=new linkedlist(); - } - public static void main(String ...naveen) - { - intersection_removeall inter=new intersection_removeall (); - inter.list.add(); - System.out.println("Display list one -"+inter.list.obj); - System.out.println("Display list two -"+inter.list.str); - inter.list.obj.removeAll(inter.list.str); - System.out.println("Intersection of list"+inter.list.obj ); - } -} diff --git a/Collection/src/linkedlist/join.java b/Collection/src/linkedlist/join.java deleted file mode 100644 index 58b5d92..0000000 --- a/Collection/src/linkedlist/join.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - */ -package linkedlist; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class join -{ - static linkedlist n; - static LinkedList join; - public join() - { super(); - n=new linkedlist(); - join=new LinkedList(); - } -public static void main(String ...naveen) -{ - join j=new join(); - n.add(); - System.out.println(" 1st linkedlist "+n.d); - System.out.println(" 1st linkedlist "+n.df); - join.addAll(n.d); - join.addAll(n.df); - System.out.println(" 1st linkedlist "+join); - -} -} diff --git a/Collection/src/linkedlist/linked_arraylist.java b/Collection/src/linkedlist/linked_arraylist.java deleted file mode 100644 index be6204f..0000000 --- a/Collection/src/linkedlist/linked_arraylist.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - */ -package linkedlist; -import java.util.*; - - -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class linked_arraylist -{ static linkedlist n; - public linked_arraylist() - { - super(); - n=new linkedlist(); - } - - public static void main(String[] args) - { new linked_arraylist() ; - System.out.println("program to covert linkedlist to arraylist"); - n.add(); - for(Integer x:n.d) - { - System.out.print(x+" , "); - } - System.out.print("\n"); - ArrayList temp=new ArrayList<>(n.d); - List temp2=new ArrayList(n.d); - System.out.println(temp); - System.out.println(temp2); - - } - -} diff --git a/Collection/src/linkedlist/linkedlist.java b/Collection/src/linkedlist/linkedlist.java deleted file mode 100644 index 10aaf3f..0000000 --- a/Collection/src/linkedlist/linkedlist.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * - */ -package linkedlist; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class linkedlist extends abstract_linkedlist -{ - public linkedlist() - { - super(); - } - public void add() - { - for(int i=1;i<=10;i++) - d.add(i); - for(int i=1;i<=10;i++) - df.add((double)i); - for(int i=1;i<=10;i++) - f.add((float)i); - String st="HELLO WORLD ITS THANOS AND IRONMAN"; - String s[]=st.split(" "); - for(String i:s) - str.add(i); - char ch[]=new char[s.length]; - for(int i=0;i0;i--) - { l.d.set(j++,i); - } - System.out.println("Displaying the linkedlist d-"+l.d); - - } - -} diff --git a/Collection/src/linkedlist/search_linkedlist.java b/Collection/src/linkedlist/search_linkedlist.java deleted file mode 100644 index f060ce6..0000000 --- a/Collection/src/linkedlist/search_linkedlist.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - */ -package linkedlist; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class search_linkedlist -{ static linkedlist n; - static Scanner nav; - public search_linkedlist() - { - n=new linkedlist(); - nav=new Scanner(System.in); - } - - public static void main(String[] args) - { - search_linkedlist sl=new search_linkedlist(); - n.add(); - System.out.println("the linked list is:"+n.d); - System.out.println("Enter the element of search "); - if(n.d.contains(nav.nextInt())) - System.out.println("The element is present"); - else - System.out.println("The element is not present"); - - } - -} diff --git a/FileHandling/FileWriterDemo.java b/FileHandling/FileWriterDemo.java deleted file mode 100644 index 230ab55..0000000 --- a/FileHandling/FileWriterDemo.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.jayan; - -import java.io.*; -import java.util.*; - -public class FileWriterDemo { - public static void main(String[] args) throws IOException { - String pathToFile; - pathToFile = "/Users/jayanpraveen/Desktop/hello-world/FILE_NAME.txt"; - - File file = new File(pathToFile); - FileWriter writer = new FileWriter(file, true); - - writer.write("Hello\n"); - writer.write("Java\n"); - - writer.close(); - } -} \ No newline at end of file diff --git a/FileHandling/PrintWriterDemo.java b/FileHandling/PrintWriterDemo.java deleted file mode 100644 index 8a67312..0000000 --- a/FileHandling/PrintWriterDemo.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.jayan; - -import java.io.*; -import java.util.*; - -public class PrintWriterDemo { - public static void main(String[] args) - throws IOException { - - String pathToFile; - pathToFile = "set-path-file.txt"; - - File file = new File(pathToFile); - PrintWriter printWriter = new PrintWriter(file); - - printWriter.print("Hello"); - printWriter.println("Java"); - printWriter.println(123); - printWriter.printf("You have %d %s", 400, "gold coins"); - - printWriter.close(); - - } - - // File file = new File("/Users/jayanpraveen/Desktop/hello-world/printwriter.txt"); - // try( - // PrintWriter printWriter = new PrintWriter(file)) - // { - // printWriter.print("Hello"); // prints a string - // printWriter.println("Java"); // prints a string and then terminates the line - // printWriter.println(123); // prints a number - // printWriter.printf("You have %d %s", 400, "gold coins"); // prints a formatted string - // }catch( - // IOException e) - // { - // System.out.printf("An exception occurs %s", e.getMessage()); - // } - -} \ No newline at end of file diff --git a/FileHandling/countEvenNumsFileDemo.java b/FileHandling/countEvenNumsFileDemo.java deleted file mode 100644 index 5889345..0000000 --- a/FileHandling/countEvenNumsFileDemo.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.jayan; - -import java.io.*; -import java.util.*; - -public class countEvenNumsFileDemo { - public static void main(String[] args) - { - String pathToFile; - pathToFile = "set-path-file.txt"; - - int countWords = 0; - - try - { - File file = new File(pathToFile); - Scanner scanner = new Scanner(file); - int value = scanner.nextInt(); - - while (scanner.hasNext()) - { - - System.out.print(value + " "); - - if (value % 2 == 0) - countWords ++; - - value = scanner.nextInt(); - - } - System.out.println("WORDS: " + countWords); - } - catch(FileNotFoundException e) - { - System.out.println("No file found:" ); - } -} -} \ No newline at end of file diff --git a/FileHandling/readFileDemo.java b/FileHandling/readFileDemo.java deleted file mode 100644 index f03c877..0000000 --- a/FileHandling/readFileDemo.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.jayan; - -import java.io.IOException; -import java.nio.file.*; -// import java.nio.file.Paths; - -public class readFileDemo -{ - public static String readFileAsString(String fileName) throws IOException - { - return new String(Files.readAllBytes(Paths.get(fileName))); - } - - public static void main(String[] args) - { - String pathToHelloWorldJava = "set-path-file.txt"; - try - { - System.out.println(readFileAsString(pathToHelloWorldJava)); - - } - catch (IOException e) - { - System.out.println("Cannot read file: " + e.getMessage()); - } - } -} \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 67ff037..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 NAVEEN - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/NAVEEN/.classpath b/NAVEEN/.classpath deleted file mode 100644 index fceb480..0000000 --- a/NAVEEN/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/NAVEEN/.project b/NAVEEN/.project deleted file mode 100644 index b1f9331..0000000 --- a/NAVEEN/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - NAVEEN - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/NAVEEN/src/Fibonacci.java b/NAVEEN/src/Fibonacci.java deleted file mode 100644 index 2984a1c..0000000 --- a/NAVEEN/src/Fibonacci.java +++ /dev/null @@ -1,30 +0,0 @@ - -import static java.lang.System.out; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class Fibonacci { - - public static void main(String[] args) { - - int n1=0; - int n2=1; - int n3; - out.print("[ "+n1+" , "+n2); - for (int i=2;i<10;i++) - { - n3=n1+n2; - out.print(" , "+n3); - n1=n2; - n2=n3; - - } - - out.print("]"); - - } - -} - diff --git a/NAVEEN/src/GopiSir.java b/NAVEEN/src/GopiSir.java deleted file mode 100644 index db4f41a..0000000 --- a/NAVEEN/src/GopiSir.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * - */ -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class GopiSir { - static ArrayList n=new ArrayList(); - - public static void deat(String str,String ans) - { - if(str.length()==0) - { - n.add(ans); - System.out.println(" "+ans); - return ; - } - deat(str.substring(1),ans); - deat(str.substring(1),ans+str.charAt(0)); - } - public static void main(String[] args) - { - deat("abc",""); - n.remove(""); - // System.out.print(n); - sort(); - } - /** - * - */ - private static void sort() - { int index=0; - String s[]=new String[n.size()]; - for(String m:n) - { - s[index++]=m.toString(); - } - System.out.println(Arrays.toString(s)); - for(int i=0;is[j].length()) - min=j; - } - String temp=s[min]; - s[min]=s[i]; - s[i]=temp; - - } - for(Object x:s) - System.out.println(x.toString()); - } - - -} diff --git a/NAVEEN/src/LinkedList2.java b/NAVEEN/src/LinkedList2.java deleted file mode 100644 index c11e97f..0000000 --- a/NAVEEN/src/LinkedList2.java +++ /dev/null @@ -1,145 +0,0 @@ -import java.io.*; -import java.util.*; -// Java program to implement -// a Singly Linked List -public class LinkedList2 { -static Node head; // head of list -static class Node { -int data; -Node next; -// Constructor -Node(int d) -{ -data = d; -next = null; -} -} -/* Inserts a new Node at front of the list. */ - public void push(int new_data) - { - - Node new_node = new Node(new_data); - - - new_node.next = head; - - - head = new_node; - } -/* Appends a new node at the end */ - public void append(int new_data) - { - - Node new_node = new Node(new_data); - - /* If the Linked List is empty, then make the new node as head */ - if (head == null) - { - head = new_node; - return; - } - - /* This new node is going to be the last node, so - make next of it as null */ - new_node.next = null; - - /* Else traverse till the last node */ - Node last = head; - while (last.next != null) - last = last.next; - - /* Change the next of last node */ - last.next = new_node; - return; - } -/* Inserts a new node after the given prev_node. */ - public void insertAfter(Node prev_node, int new_data) - { - - if (prev_node == null) - { - System.out.println("There are no elements in the list: This operation is invalid for the time being"); - return; - } - - - Node new_node = new Node(new_data); - - - new_node.next = prev_node.next; - - - prev_node.next = new_node; - return; - } -/* This function prints contents of linked list starting from the given node */ - public void printList() - { - Node tnode = head; -if(tnode==null) -{System.out.print("empty list"); -} - while (tnode!= null) - { - System.out.print(tnode.data+" "); - tnode = tnode.next; - } - } - public void pop() - { - if(head==null) - { - System.out.println(":underlow:"); - } - else - { System.out.println("poping element:"+head.data+"from linkedlist"); - head=head.next; - } - - } -public static void main(String[] args) -{ -LinkedList2 list = new LinkedList2(); -list.head=null; -Scanner scan = new Scanner(System.in); -char ch; -do -{ -System.out.println("\nLinked list Operations"); -System.out.println("1. insert at begining"); -System.out.println("2. insert at end"); -System.out.println("3. insert at specified location"); -System.out.println("4. display"); -int choice = scan.nextInt(); -switch (choice) -{case 1 : -System.out.print("Insert at begining:"); -list.push(scan.nextInt()); -break; -case 2: -System.out.print("Insert at end:"); - list.append(scan.nextInt()); -break; -case 3: -System.out.print("Insert the location after which u want to insert:"); -int loc=scan.nextInt(); -Node temp; -temp=head; -System.out.print("Insert the data:"); -if(loc==1) -{list.insertAfter(temp, scan.nextInt());} -else{ -for(int i=1;imax-1) - System.out.println(":::::OVERFLOW OF STACK::::"); - else - { top++; - int ele=nav.nextInt(); - sta[top]=ele; - System.out.println(sta[top]+"is pushed into stack"); - - } - } - public static void pop() - { - if(top<=-1) - System.out.println(":::::Stack under flow:::::"); - else - { - int del=sta[top]; - System.out.println(del+":::::is poped out from stack:::::"); - top--; - } - } - public static void display() - { - if(top>=0) - { - for(int i=top;i>=0;i--) - System.out.println(sta[i]+"\n"); - } - else - System.out.println("::::: stack is empty:::::"); - } - - public static void main(String agr[]) - { - - String myStr1 = "Hello"; - String myStr2 = "Hello"; - String myStr3 = "Another Hello"; - System.out.println(myStr1.equals(myStr2)); // Returns true because they are equal - System.out.println(myStr1.equals(myStr3)); - System.out.println("Stack size"); - max = nav.nextInt(); - int z1; - System.out.print("1)push\n2)______________>>>>>>>>pop\n3)__________>>>>>peek\n4)>>>>>>>>>EXIT"); - do{ - z1=nav.nextInt(); - switch(z1) - { - case 1: System.out.print("enter to push "); - push(); - break; - case 2: System.out.print("pop "); - pop(); - break; - case 3: System.out.print("top display "); - display(); - break; - case 4: System.out.println("exit :"); - break; - default:System.out.print("error "); - } - }while(z1!=4); - } - - - } - - - - - - - - diff --git a/NAVEEN/src/REVSTR.java b/NAVEEN/src/REVSTR.java deleted file mode 100644 index 82e9d33..0000000 --- a/NAVEEN/src/REVSTR.java +++ /dev/null @@ -1,43 +0,0 @@ -import java.util.Scanner; -public class REVSTR -{ static Scanner nav=new Scanner(System.in); - static char rev[]=new char [25]; - static int top; - REVSTR() - { - top=-1; - } - public static void main(String arg[]) - { - System.out.println("enter the orignal:::------>>>>>"); - String str=nav.nextLine(); - for(int i=0;i>>>>"); - for(int i=top;i>=0;--i) - { - pop(); - } - } - public static void push( char c) - { top++; - - rev[top]=c; - System.out.println(c); - - } - - public static void pop() - { - System.out.print(rev[top]+" "); - top--; - } - - - - - - -} diff --git a/NAVEEN/src/Stack1.java b/NAVEEN/src/Stack1.java deleted file mode 100644 index 6e72ab9..0000000 --- a/NAVEEN/src/Stack1.java +++ /dev/null @@ -1,79 +0,0 @@ -import java.util.*; -public class Stack1 -{ - static int top; - static int size,size1; - static int stac[]; - static Scanner sin=new Scanner(System.in); - - public Stack1(int n) - { size1=n; - top=-1; - stac=new int [size1]; - - } -public static void push() -{ -if(top>size-1) -{ -System.out.println("overflow"); -} -else -{ -top=top+1; -int elm=sin.nextInt(); -stac[top]=elm; -System.out.println(elm+"pushed into stack"); -} - } -public static void pop() -{ -if(top<=-1) -{ -System.out.println("underflow"); -} -else -{ -int del=stac[top--]; -System.out.println(del+"was poped out"); -} - } -public static void display() -{ -if(top>=0) -{ -for(int i=top;i>=0;i--) -{ -System.out.println(stac[top]); -} -} -else -{ -System.out.println("stack is empty"); -} -} -public static void main(String arg[]) -{ int z1; -System.out.println("enter the stack size"); -size=sin.nextInt(); -Stack1 n=new Stack1(size); - -do -{ - z1=sin.nextInt(); - -switch(z1) -{ -case 1:push(); - break; -case 2:pop(); - break; -case 3:display(); -break; -case 4:System.out.println("error"); -break; -} -}while(z1!=4); - -} -} \ No newline at end of file diff --git a/NAVEEN/src/TR.java b/NAVEEN/src/TR.java deleted file mode 100644 index d5fd571..0000000 --- a/NAVEEN/src/TR.java +++ /dev/null @@ -1,224 +0,0 @@ - - -import java.util.Scanner; - - - class BTNode - { - BTNode left, right; - int data; - - - public BTNode() - { - left = null; - right = null; - data = 0; - } - - public BTNode(int n) - { - left = null; - right = null; - data = n; - } - - public void setLeft(BTNode n) - { - left = n; - } - - public void setRight(BTNode n) - { - right = n; - } - - public BTNode getLeft() - { - return left; - } - - public BTNode getRight() - { - return right; - } - - public void setData(int d) - { - data = d; - } - - public int getData() - { - return data; - } - } - - - class BT - { - private BTNode root; - - - public BT() - { - root = null; - } - - public boolean isEmpty() - { - return root == null; - } - - public void insert(int data) - { - root = insert(root, data); - } - - private BTNode insert(BTNode node, int data) - { - if (node == null) - node = new BTNode(data); - else - { - if (node.getRight() == null) - node.right = insert(node.right, data); - else - node.left = insert(node.left, data); - } - return node; - } - - public int countNodes() - { - return countNodes(root); - } - - private int countNodes(BTNode r) - { - if (r == null) - return 0; - else - { - int l = 1; - l += countNodes(r.getLeft()); - l += countNodes(r.getRight()); - return l; - } - } - - public boolean search(int val) - { - return search(root, val); - } - - private boolean search(BTNode r, int val) - { - if (r.getData() == val) - return true; - if (r.getLeft() != null) - if (search(r.getLeft(), val)) - return true; - if (r.getRight() != null) - if (search(r.getRight(), val)) - return true; - return false; - } - - public void inorder() - { - inorder(root); - } - private void inorder(BTNode r) - { - if (r != null) - { - inorder(r.getLeft()); - System.out.print(r.getData() +" "); - inorder(r.getRight()); - } - } - - public void preorder() - { - preorder(root); - } - private void preorder(BTNode r) - { - if (r != null) - { - System.out.print(r.getData() +" "); - preorder(r.getLeft()); - preorder(r.getRight()); - } - } - - public void postorder() - { - postorder(root); - } - private void postorder(BTNode r) - { - if (r != null) - { - postorder(r.getLeft()); - postorder(r.getRight()); - System.out.print(r.getData() +" "); - } - } - } - - - public class TR - { - public static void main(String[] args) - { - Scanner scan = new Scanner(System.in); - - BT bt = new BT(); - - System.out.println("Binary Tree Test\n"); - char ch; - do - { - System.out.println("\nBinary Tree Operations\n"); - System.out.println("1. insert "); - System.out.println("2. search"); - System.out.println("3. count nodes"); - System.out.println("4. check empty"); - - int choice = scan.nextInt(); - switch (choice) - { - case 1 : - System.out.println("Enter integer element to insert"); - bt.insert( scan.nextInt() ); - break; - case 2 : - System.out.println("Enter integer element to search"); - System.out.println("Search result : "+ bt.search( scan.nextInt() )); - break; - case 3 : - System.out.println("Nodes = "+ bt.countNodes()); - break; - case 4 : - System.out.println("Empty status = "+ bt.isEmpty()); - break; - default : - System.out.println("Wrong Entry \n "); - break; - } - - System.out.print("\nPost order : "); - bt.postorder(); - System.out.print("\nPre order : "); - bt.preorder(); - System.out.print("\nIn order : "); - bt.inorder(); - - System.out.println("\n\nDo you want to continue (Type y or n) \n"); - ch = scan.next().charAt(0); - } while (ch == 'Y'|| ch == 'y'); - } - } - diff --git a/NAVEEN/src/TestLease.java b/NAVEEN/src/TestLease.java deleted file mode 100644 index e42e74a..0000000 --- a/NAVEEN/src/TestLease.java +++ /dev/null @@ -1,94 +0,0 @@ -import java.util.*; -public class TestLease -{ public TestLease(String name, long number, float rent, int lease_mouths) { - - this.name = name; - this.number = number; - this.rent = rent; - this.lease_mouths = lease_mouths; - } - -public String name; - long number; - float rent; - int lease_mouths; - boolean pet=false; - TestLease () - { - name="XXX"; - number=0; - rent=1000; - lease_mouths=12; - } - - public void addPet() - { if(pet) - { rent=rent+(10*lease_mouths);} - explainPetPolicy(); - } - -public TestLease(String name, long number, float rent, int lease_mouths, boolean pet) { - super(); - this.name = name; - this.number = number; - this.rent = rent; - this.lease_mouths = lease_mouths; - this.pet = pet; - addPet(); -} - -public boolean isPet() { - return pet; -} - -public void setPet(boolean pet) { - this.pet = pet; -} - -private static void explainPetPolicy() { - - System.out.println("Pets are charged 10 dollar per month"); -} - -public String getName() { - return name; -} - -public void setName(String name) { - this.name = name; -} - -public long getNumber() { - return number; -} - -public void setNumber(long number) { - this.number = number; -} - -public float getRent() { - return rent; -} - -public void setRent(float rent) { - this.rent = rent; -} - -public int getLease_mouths() { - return lease_mouths; -} - -public void setLease_mouths(int lease_mouths) { - this.lease_mouths = lease_mouths; -} - -public String toString() -{ System.out.println("1)name of apt :"+name+"\n2)apt number :"+number+"\n3)Rent :"+rent+"\n4)lease Months :"+lease_mouths +"\n5)Pet is there :"+pet); - return ""; - } -public static void main(String[] args) -{ - TestLease t=new TestLease("DARKHOUSE", 005, 3000,24, true); - t.toString(); -} -} \ No newline at end of file diff --git a/NAVEEN/src/Threaddemo.java b/NAVEEN/src/Threaddemo.java deleted file mode 100644 index 6a19c95..0000000 --- a/NAVEEN/src/Threaddemo.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - */ - -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -class Threads extends Thread { - synchronized void waiting() { - try { - System.out.println("wait"+Thread.currentThread().getName()); - wait(); - } catch (InterruptedException e) { - } - } - synchronized void notifying() { - System.out.println("notify me"+Thread.currentThread().getName()); - notify(); - } -} -public class Threaddemo { - public static void main(String args[]) { - Threads t1=new Threads(); - t1.setName("first"); - Threads t2=new Threads(); - t2.setName("second"); - t1.start(); - t2.start(); - } -} \ No newline at end of file diff --git a/NAVEEN/src/arrays.java b/NAVEEN/src/arrays.java deleted file mode 100644 index 70955df..0000000 --- a/NAVEEN/src/arrays.java +++ /dev/null @@ -1,77 +0,0 @@ -import java.util.*; - -public class arrays -{ static Scanner nav=new Scanner(System.in); - static int array[],size; - public arrays(int data) - { - size=data; - array=new int[size]; - } - public static void input() - { - for(int i=0;i n=new ArrayList <>(); - // n=new ArrayList();// The final local variable n cannot be assigned. It must be blank and not using a compound - // assignment - n.add(233); - n.add("db"); - // System.out.println("N1 -"+n); - - ArrayList n2=n; - - n2.add("REFERNCES"); - - System.out.println("N1-"+n); - - System.out.println("N2-"+n2); - - // System.out.println(Arrays.toString(str)); - - - } -} diff --git a/NAVEEN/src/cirque.java b/NAVEEN/src/cirque.java deleted file mode 100644 index 7a85c8a..0000000 --- a/NAVEEN/src/cirque.java +++ /dev/null @@ -1,88 +0,0 @@ -import java.util.*; -public class cirque -{ static Scanner nav=new Scanner(System.in); - static int front,rear,size; - static int cirque[]; - public cirque(int n) - { size=n; - cirque=new int[size]; - front=rear=-1; - - } - public static void enque() - { - if((rear+1)%size==front) - { - System.out.println("::OVERFLOW::"); - } - else - { - System.out.println("ENTER THE ELEMENT TO PUSH::"); - int ele=nav.nextInt(); - if(rear==-1&&front==-1) - { rear=front=0; - cirque[rear]=ele; - } - else - { - rear=(rear+1)%size; - cirque[rear]=ele; - } - System.out.println("the element"+cirque[rear]+"pushed "); - } - } - public static void deque() - { - if(front==-1) - { - System.out.println("::underFLOW::"); - } - else - { int del=cirque[front]; - System.out.println("the element"+del+"poped "); - if(rear==front) - { - rear=front=-1; - } - - else - { - front=(front+1)%size; - } - } - } - - public static void display() - { - if(rear==-1 && front==-1) - System.out.println("::underFLOW::"); - else - for(int i=front;i<=rear;++i) - { - System.out.println("elements in queue+"+cirque[i]); - - - } - } - public static void main(String[] args) - { System.out.println("ENTER THE SIZE ::"); - int na; - int size1 =nav.nextInt(); - cirque n =new cirque(size1); - do{ - System.out.println("ENTER THE CHOICES ::"); - na=nav.nextInt(); - switch(na) - { - case 1: n.enque(); - break; - case 2: n.deque(); - break; - case 3: n.display(); - break; - case 4: System.out.println("::exit"); - break; - } - }while(na!=4); - } -} diff --git a/NAVEEN/src/dobllylinked.java b/NAVEEN/src/dobllylinked.java deleted file mode 100644 index 6eecc5e..0000000 --- a/NAVEEN/src/dobllylinked.java +++ /dev/null @@ -1,217 +0,0 @@ -import java.util.Scanner; - -public class dobllylinked -{ static node head; - - public dobllylinked() - { - head=null; - } - static class node - { - int data; - node next; - node prev; - - public node(int d) - { - data=d; - next=null; - prev=null; - } - - } - public static void insertbegin(int newdata) - { - node newnode=new node (newdata); - if(head==null) - { - head=newnode; - return ; - } - else - { - newnode.next=head; - head.prev=newnode; - head=newnode; - return ; - } - - } - public static void insertend(int newdata) - { - node newnode=new node(newdata); - if (head ==null) - { - head=newnode; - return ; - } - else - { - node last=head; - while(last.next!=null) - { - last=last.next; - } - last.next=newnode; - newnode.prev=last; - return ; - } - } - public static void insertafter(node prenode,int newdata) - { - - if(prenode==null) - { - System.out.println("NOT POSSIBLE"); - return; - } - else - { node newnode =new node(newdata); - newnode.next=prenode.next; - newnode.prev=prenode; - prenode.next.prev=newnode; - prenode.next=newnode; - return; - } - } - - public static void display() - { - if(head==null) - { - System.out.println("linkedlist is empty"); - return ; - } - System.out.print(" nodes in list are "); - node last=head; - while(last!=null) - { System.out.print(" "+last.data+" "); - last=last.next; - } - return; - } - - public static void deletestart() - { - if(head==null ||head.next==null) - { System.out.println(head.data+" "+"has been deleted"); - head=null; - return; - } - else - { System.out.println(head.data+" "+"has been deleted"); - head=head.next; - head.prev=null; - return; - } - } - public static void deleteend() - { - if(head==null) - { - System.out.println("no element"); - return; - } - else - { - node del=head; - while(del.next!=null) - { - del=del.next; - } - System.out.println(del.data+" "+"has been deleted"); - del.prev.next=null; - } - } - public static void delpos(int delpos) - { node temp=head; - if(head==null) - return; - else if(head.next==null) - { - System.out.println(head.data+" "+"has been deleted"); - head=null; - return; - } - else if(delpos==1) - { - head=head.next; - head.prev=null; - return; - } - - else - { - - for( int i=1;temp!=null&&i=0;i--) - System.out.println(stack[top]); - } - } - - public static void main(String agr[]) - { int ch; - System.out.println("enter the size of stack"); - int s=nav.nextInt(); - lab1stack n=new lab1stack(s); - do - { System.out.println("1>push"); - System.out.println("2>pop"); - System.out.println("3>Display"); - System.out.println("4>Exit()"); - ch=nav.nextInt(); - switch(ch) - { - case 1: n.push(); - break; - case 2 :n.pop(); - break; - case 3: n.display(); - break; - case 4: System.out.println("ERROR"); - } - - }while(ch!=4); - } -} diff --git a/NAVEEN/src/link.java b/NAVEEN/src/link.java deleted file mode 100644 index 7e90972..0000000 --- a/NAVEEN/src/link.java +++ /dev/null @@ -1,157 +0,0 @@ -import java.util.Scanner; - -public class link -{ - static node head; - link() - { - head=null; - } - public static class node - { - int data; - node next; - public node(int m) - { - data=m; - next=null; - } - - } - public static void insertbegin(int newdata) - { - node newnode = new node(newdata); - newnode.next=head; - head=newnode; - - } - - - public static void insertpos(node prevnode,int newdata) - { - if(prevnode==null) - { - System.out.println("not possible"); - } - node newnode=new node( newdata); - newnode.next=prevnode.next; - prevnode.next=newnode; - } - public void insertend(int newdata) - { - - node newnode = new node(newdata); - - if (head == null) - { - head = newnode; - return; - } - - - newnode.next = null; - - node last = head; - while (last.next != null) - last = last.next; - - last.next = newnode; - return; - } - public static void display() - { node tnode=head; - if(tnode==null) - {System.out.println("empty");} - else - { while((tnode.next)!=null) - { System.out.print(tnode.data+" "); - tnode=tnode.next; - } - System.out.print(tnode.data+" "); - } - } - public static void pop() - { - if(head==null) - { - System.out.println("empty"); - } - else - { - head=head.next; - } - } - public static void search( int x) - - { - - node current = head; - - while (current != null) - - { - - if (current.data == x) - System.out.println("dfound "); - current = current.next; - } - - System.out.println("NOT found "); - - } - - public static void main(String[] args) - { - link list = new link(); - Scanner scan = new Scanner(System.in); - char ch; - do - { - System.out.println("\nLinked list Operations"); - System.out.println("1. insert at begining"); - System.out.println("2. insert at end"); - System.out.println("3. insert at specified location"); - System.out.println("4. display"); - int choice = scan.nextInt(); - switch (choice) - {case 1 : - System.out.print("Insert at begining:"); - list.insertbegin(scan.nextInt()); - break; - case 2: - System.out.print("Insert at end:"); - list.insertend(scan.nextInt()); - break; - case 3: - System.out.print("Insert the location after which u want to insert:"); - int loc=scan.nextInt(); - node temp; - temp=head; - System.out.print("Insert the data:"); - if(loc==1) - {list.insertpos(temp, scan.nextInt());} - else{ - for(int i=1;i=0) - { - for(int i=top;i>=0;i--) - System.out.println(sta[i]+"\n"); - } - else - System.out.println("::::: stack is empty:::::"); - } - - public static void main(String agr[]) - { - System.out.println("Stack size"); - int ma1 = nav.nextInt(); - sll na=new sll(ma1); - int z1; - System.out.print("1)push\n2)______________>>>>>>>>pop\n3)__________>>>>>peek\n4)>>>>>>>>>EXIT"); - do{ - z1=nav.nextInt(); - switch(z1) - { - case 1: System.out.print("enter to push "); - push(); - break; - case 2: System.out.print("pop "); - pop(); - break; - case 3: System.out.print("top display "); - display(); - break; - case 4: System.out.println("exit :"); - break; - default:System.out.print("error "); - } - }while(z1!=4); - } - - - } - - - - - - - - diff --git a/NAVEEN/src/sort.java b/NAVEEN/src/sort.java deleted file mode 100644 index 6638462..0000000 --- a/NAVEEN/src/sort.java +++ /dev/null @@ -1,57 +0,0 @@ -import java.util.*; -import java.util.Arrays; - -public class sort { - static Scanner nav=new Scanner(System.in); - public static void main(String[] args) - { System.out.println("enter size"); - int size=nav.nextInt(); - int a[]=new int[size]; - for (int i=0;i<=size-1;i++) - a[i]=nav.nextInt(); - - System.out.println(Arrays.toString(a)); - mergeSort(a, 0, a.length); - - for (int i = 0; i < a.length; i++) - { - System.out.print(a[i]+","); - } - } - - public static void mergeSort(int[] input, int start, int end) { - - if (end - start < 2) { - return; - } - - int mid = (start + end) / 2; - mergeSort(input, start, mid); - mergeSort(input, mid, end); - merge(input, start, mid, end); - } - - - public static void merge(int[] input, int start, int mid, int end) { - - if (input[mid - 1] <= input[mid]) { - return; - } - - int i = start; - int j = mid; - int tempIndex = 0; - - int[] temp = new int[end - start]; - while (i < mid && j < end) { - temp[tempIndex++] = input[i] <= input[j] ? input[i++] : input[j++]; - } - - System.arraycopy(input, i, input, start + tempIndex, mid - i); - System.arraycopy(temp, 0, input, start, tempIndex); - - - } - -} - diff --git a/NAVEEN/src/sorting.java b/NAVEEN/src/sorting.java deleted file mode 100644 index aea940b..0000000 --- a/NAVEEN/src/sorting.java +++ /dev/null @@ -1,57 +0,0 @@ -import java.util.Arrays; -import java.util.*; - -public class sorting -{ - - public static void qicksort(int a[],int l,int r) - { - - if(l=l&&a[j]>pivot) - j--; - - if(i=max-1) - System.out.println(":::::OVERFLOW OF STACK::::"); - else - { top++; - int ele=nav.nextInt(); - sta[top]=ele; - System.out.println(sta[top]+"is pushed into stack"); - - } - } - public static void pop() - { - if(top<=-1) - System.out.println(":::::Stack under flow:::::"); - else - { - int del=sta[top]; - System.out.println(del+":::::is poped out from stack:::::"); - top--; - } - } - public static void display() - { - if(top>=0) - { - for(int i=top;i>=0;i--) - System.out.println(sta[i]+"\n"); - } - else - System.out.println("::::: stack is empty:::::"); - } - - public static void main(String agr[]) - { - System.out.println("Stack size"); - int ma1 = nav.nextInt(); - stac na=new stac(ma1); - int z1; - System.out.print("1)push\n2)______________>>>>>>>>pop\n3)__________>>>>>peek\n4)>>>>>>>>>EXIT"); - do{ - z1=nav.nextInt(); - switch(z1) - { - case 1: System.out.print("enter to push "); - push(); - break; - case 2: System.out.print("pop "); - pop(); - break; - case 3: System.out.print("top display "); - display(); - break; - case 4: System.out.println("exit :"); - break; - default:System.out.print("error "); - } - }while(z1!=4); - } - - - } - - - - - - - - diff --git a/NAVEEN/src/subarray.java b/NAVEEN/src/subarray.java deleted file mode 100644 index 2f95b02..0000000 --- a/NAVEEN/src/subarray.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - */ -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -class subarray { - - - public static void main(String[] args) - { int sum=0; - int a[]= {1,4,2,5,3}; - for(int i=0;i { - for(int i=0; i<5000; i++) { - System.out.println("Processing step " + (i + 1) + "/5"); - Thread.sleep(1000); // Simulate work - } - System.out.println(">>> Running batch job with REST trigger <<<"); - return RepeatStatus.FINISHED; - }, transactionManager).allowStartIfComplete(true) - .build(); - } - - @Bean - public JobRepository jobRepository(DataSource dataSource, PlatformTransactionManager transactionManager) throws Exception { - JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean(); - factory.setDataSource(dataSource); - factory.setTransactionManager(transactionManager); - factory.afterPropertiesSet(); - return factory.getObject(); - } - - @Bean - public JobLauncher jobLauncher(JobRepository jobRepository) throws Exception { - TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher(); - jobLauncher.setJobRepository(jobRepository); - - ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - executor.setCorePoolSize(2); - executor.setMaxPoolSize(2); - executor.setQueueCapacity(2); - executor.setThreadNamePrefix("batch-job-"); - executor.initialize(); - - jobLauncher.setTaskExecutor(executor); - jobLauncher.afterPropertiesSet(); - return jobLauncher; - } - - @Bean - public Customizer defaultCustomizer() { - return factory -> factory.configureDefault(id -> new Resilience4JConfigBuilder(id) - .timeLimiterConfig(TimeLimiterConfig.custom().timeoutDuration(Duration.ofSeconds(4)).build()) - .circuitBreakerConfig(CircuitBreakerConfig.ofDefaults()) - .build()); - } - - @Bean - public Customizer reactiveSpecificBulkheadCustomizer() { - return provider -> provider.configure(builder -> { - builder.bulkheadConfig(BulkheadConfig.custom() - .maxConcurrentCalls(2) - .build()); - }, "serviceBulkhead"); - } - - - -} diff --git a/OOP/src/main/java/org/example/component/TimeoutListener.java b/OOP/src/main/java/org/example/component/TimeoutListener.java deleted file mode 100644 index 60d152d..0000000 --- a/OOP/src/main/java/org/example/component/TimeoutListener.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.example.component; - -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.JobExecutionListener; -import org.springframework.stereotype.Component; - -@Component -public class TimeoutListener implements JobExecutionListener { - - @Override - public void beforeJob(JobExecution jobExecution) { - System.out.println("Job is starting..."); - } - - @Override - public void afterJob(JobExecution jobExecution) { - System.out.println("Job has ended."); - } -} \ No newline at end of file diff --git a/OOP/src/main/java/org/example/controller/Batch.java b/OOP/src/main/java/org/example/controller/Batch.java deleted file mode 100644 index c9f2360..0000000 --- a/OOP/src/main/java/org/example/controller/Batch.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.example.controller; - - -import lombok.extern.slf4j.Slf4j; -import org.springframework.batch.core.Job; -import org.springframework.batch.core.JobParameters; -import org.springframework.batch.core.JobParametersBuilder; -import org.springframework.batch.core.JobParametersInvalidException; -import org.springframework.batch.core.launch.JobLauncher; -import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; -import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException; -import org.springframework.batch.core.repository.JobRestartException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; - -@Slf4j -@Controller -public class Batch { - - - @Autowired - private JobLauncher jobLauncher; - - - @Autowired - private Job demoJob; - - - - @GetMapping("/batch") - private ResponseEntity signUp() throws JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException { - JobParameters params = new JobParametersBuilder() - .addLocalDateTime("date", java.time.LocalDateTime.now()) - .toJobParameters(); - jobLauncher.run(demoJob, params); - log.info("==============================="); - return ResponseEntity.ok("Hello World"); - } - - -} diff --git a/OOP/src/main/java/org/example/service/ExternalReactiveService.java b/OOP/src/main/java/org/example/service/ExternalReactiveService.java deleted file mode 100644 index 6d695ae..0000000 --- a/OOP/src/main/java/org/example/service/ExternalReactiveService.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.example.service; - -import org.springframework.web.reactive.function.client.WebClient; -import io.github.resilience4j.bulkhead.annotation.Bulkhead; -import org.springframework.stereotype.Service; -import reactor.core.publisher.Mono; - -@Service -public class ExternalReactiveService { - @Bulkhead(name = "serviceBulkhead", type = Bulkhead.Type.THREADPOOL) - public Mono fetchData() { - return WebClient.create().get().uri("https://example.com").retrieve().bodyToMono(String.class); - } -} \ No newline at end of file diff --git a/OOP/src/main/resources/application.properties b/OOP/src/main/resources/application.properties deleted file mode 100644 index 1ae0bf4..0000000 --- a/OOP/src/main/resources/application.properties +++ /dev/null @@ -1,16 +0,0 @@ -## Spring JPA -spring.datasource.url=jdbc:postgresql://localhost:5432/postgres -spring.datasource.username=postgres -spring.datasource.password=naveen -spring.jpa.hibernate.ddl-auto=none -spring.jpa.show-sql=true -spring.jpa.properties.hibernate.format_sql=false -hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect -spring.servlet.multipart.enabled=true -spring.servlet.multipart.max-file-size=50MB -spring.servlet.multipart.max-request-size=60MB -spring.output.ansi.enabled=ALWAYS -management.endpoint.metrics.enabled=true -management.endpoints.prometheus.enabled=true -management.endpoints.web.exposure.include=* -spring.batch.jdbc.initialize-schema=never diff --git a/OOP/thisDemo.java b/OOP/thisDemo.java deleted file mode 100644 index 48584c5..0000000 --- a/OOP/thisDemo.java +++ /dev/null @@ -1,30 +0,0 @@ -class Sample -{ - int value; - - Sample() - { - this("Passed_value"); - } - - public Sample(String str) - { - System.out.println(str + " by this()"); - } - - public void setValue (int value) - { - this.value = value; - } -} -public class thisDemo -{ - public static void main(String[] args) - { - Sample obj = new Sample(); - - obj.setValue(123); - System.out.println(obj.value); - } -} - diff --git a/OopsLab/.classpath b/OopsLab/.classpath deleted file mode 100644 index ff1dc5a..0000000 --- a/OopsLab/.classpath +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/OopsLab/.project b/OopsLab/.project deleted file mode 100644 index b8023df..0000000 --- a/OopsLab/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - OopsLab - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/OopsLab/Finalthread.ser b/OopsLab/Finalthread.ser deleted file mode 100644 index bc0ef43..0000000 Binary files a/OopsLab/Finalthread.ser and /dev/null differ diff --git a/OopsLab/Output b/OopsLab/Output deleted file mode 100644 index 80921ce..0000000 Binary files a/OopsLab/Output and /dev/null differ diff --git a/OopsLab/Output.ser b/OopsLab/Output.ser deleted file mode 100644 index e7701a9..0000000 Binary files a/OopsLab/Output.ser and /dev/null differ diff --git a/OopsLab/Output.sr b/OopsLab/Output.sr deleted file mode 100644 index 80921ce..0000000 Binary files a/OopsLab/Output.sr and /dev/null differ diff --git a/OopsLab/Output.txt b/OopsLab/Output.txt deleted file mode 100644 index b979ae3..0000000 Binary files a/OopsLab/Output.txt and /dev/null differ diff --git a/OopsLab/Outputthread.ser b/OopsLab/Outputthread.ser deleted file mode 100644 index 97252fb..0000000 Binary files a/OopsLab/Outputthread.ser and /dev/null differ diff --git a/OopsLab/Outputthread2.ser b/OopsLab/Outputthread2.ser deleted file mode 100644 index f520b84..0000000 Binary files a/OopsLab/Outputthread2.ser and /dev/null differ diff --git a/OopsLab/Outputthread3.ser b/OopsLab/Outputthread3.ser deleted file mode 100644 index 35dd175..0000000 Binary files a/OopsLab/Outputthread3.ser and /dev/null differ diff --git a/OopsLab/demo.gif b/OopsLab/demo.gif deleted file mode 100644 index fd71b40..0000000 Binary files a/OopsLab/demo.gif and /dev/null differ diff --git a/OopsLab/demo3 (1).gif b/OopsLab/demo3 (1).gif deleted file mode 100644 index 45a0d90..0000000 Binary files a/OopsLab/demo3 (1).gif and /dev/null differ diff --git a/OopsLab/demo3 (2).gif b/OopsLab/demo3 (2).gif deleted file mode 100644 index 5513344..0000000 Binary files a/OopsLab/demo3 (2).gif and /dev/null differ diff --git a/OopsLab/src/Day10/Threadss.java b/OopsLab/src/Day10/Threadss.java deleted file mode 100644 index 8a8ec43..0000000 --- a/OopsLab/src/Day10/Threadss.java +++ /dev/null @@ -1,169 +0,0 @@ -/** - * - */ -package Day10; - -import java.io.FileOutputStream; -import java.io.ObjectOutputStream; -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class Threadss { - - public Threadss() { - - } - - public static void main(String[] args) - { new A().n=100; - A x=new A(); - x.start(); - - new B().n=100; - B v=new B(); - v.start(); - - C c=new C(); - c.start(); - try { - c.join(); - v.join(); - x.join(); - } catch (InterruptedException e) { - - e.printStackTrace(); - } - //ArrayList finals=new ArrayList(); - Set setss=new HashSet(); - for(Object temp:x.arr) - setss.add(temp); - for(Object temp:v.arr) - setss.add(temp); - for(Object temp:c.arr) - setss.add(temp); - - - System.out.println("Set---------"+setss); - - try { - FileOutputStream f=new FileOutputStream("Finalthread.ser"); - ObjectOutputStream obj=new ObjectOutputStream(f); - obj.writeObject(setss); - obj.flush(); - obj.close(); - } - catch(Exception e) { - e.printStackTrace(); - } - - } - -} - -class A extends Thread{ - static int n; - ArrayList arr=new ArrayList(); - public void run() - { Random r=new Random(); - - for(int i=0;i arr=new ArrayList(); - public void run() - { Random r=new Random(); - - for(int i=0;i arr=new ArrayList(); - public void run() - { Random r=new Random(); - - for(int i=0;i<4;i++) - { int ran=r.nextInt(50)+1; - arr.add(ran); - } - write(); - } - public void write() - { System.out.println("Number one two 1-50 :"+arr); - try { - FileOutputStream f=new FileOutputStream("Outputthread3.ser"); - ObjectOutputStream obj=new ObjectOutputStream(f); - obj.writeObject(arr); - obj.flush(); - obj.close(); - } - catch(Exception e) { - e.printStackTrace(); - } - } -} \ No newline at end of file diff --git a/OopsLab/src/Day10/package-info.java b/OopsLab/src/Day10/package-info.java deleted file mode 100644 index e05b000..0000000 --- a/OopsLab/src/Day10/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -package Day10; \ No newline at end of file diff --git a/OopsLab/src/Day11_Swing/Gui.java b/OopsLab/src/Day11_Swing/Gui.java deleted file mode 100644 index aef0038..0000000 --- a/OopsLab/src/Day11_Swing/Gui.java +++ /dev/null @@ -1,244 +0,0 @@ -/** - * - */ -package Day11_Swing; -import java.util.*; - - - -import org.jdatepicker.impl.*; -import java.text.*; -import java.time.format.*; - -import javax.swing.JPanel; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.*; -import javax.swing.JFormattedTextField.AbstractFormatter; - -public class Gui { - - private JFrame frame; - private JTextField textField; - private JTextField textField_1; - private JTextField textField_2; - - private JTextField textField_3; - private JTextField textField_4; - String Name,mName,LName,Number,Adrress,profession; - String gender; - Date datee; - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - Gui window = new Gui(); - window.frame.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the application. - */ - public Gui() { - initialize(); - } - - /** - * Initialize the contents of the frame. - */ - private void initialize() { - frame = new JFrame(); - frame.setBounds(100, 100, 693, 776); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.getContentPane().setLayout(null); - - JLabel lblNewLabel = new JLabel("First Name :"); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 16)); - lblNewLabel.setBounds(35, 20, 115, 26); - frame.getContentPane().add(lblNewLabel); - - textField = new JTextField(); - textField.setBounds(20, 56, 161, 25); - frame.getContentPane().add(textField); - textField.setColumns(10); - - JLabel lblNewLabel_1 = new JLabel("Middle Name :"); - lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 16)); - lblNewLabel_1.setBounds(241, 20, 137, 26); - frame.getContentPane().add(lblNewLabel_1); - - textField_1 = new JTextField(); - textField_1.setBounds(230, 54, 161, 29); - frame.getContentPane().add(textField_1); - textField_1.setColumns(10); - - JLabel lblNewLabel_2 = new JLabel("Last Name :"); - lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 16)); - lblNewLabel_2.setBounds(494, 20, 101, 26); - frame.getContentPane().add(lblNewLabel_2); - - textField_2 = new JTextField(); - textField_2.setBounds(473, 54, 161, 29); - frame.getContentPane().add(textField_2); - textField_2.setColumns(10); - - JLabel lblNewLabel_3 = new JLabel("Address :"); - lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 16)); - lblNewLabel_3.setBounds(34, 136, 130, 37); - frame.getContentPane().add(lblNewLabel_3); - - JTextArea textArea = new JTextArea(); - textArea.setBounds(230, 144, 161, 109); - frame.getContentPane().add(textArea); - - JLabel lblNewLabel_4 = new JLabel("Number"); - lblNewLabel_4.setFont(new Font("Tahoma", Font.BOLD, 16)); - lblNewLabel_4.setBounds(35, 294, 124, 37); - frame.getContentPane().add(lblNewLabel_4); - - textField_3 = new JTextField(); - textField_3.setBounds(230, 305, 161, 29); - - frame.getContentPane().add(textField_3); - textField_3.setColumns(10); - - JRadioButton rdbtnNewRadioButton = new JRadioButton("Male"); - rdbtnNewRadioButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) - { - gender="Male"; - } - }); - rdbtnNewRadioButton.setSelected(true); - rdbtnNewRadioButton.setFont(new Font("Tahoma", Font.BOLD, 16)); - rdbtnNewRadioButton.setBounds(187, 378, 103, 41); - frame.getContentPane().add(rdbtnNewRadioButton); - - JLabel lblNewLabel_5 = new JLabel("Gender"); - lblNewLabel_5.setFont(new Font("Tahoma", Font.BOLD, 16)); - lblNewLabel_5.setBounds(35, 380, 129, 37); - frame.getContentPane().add(lblNewLabel_5); - - JRadioButton rdbtnFemale = new JRadioButton("Female"); - rdbtnFemale.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) - { - gender="Female"; - } - }); - rdbtnFemale.setFont(new Font("Tahoma", Font.BOLD, 16)); - rdbtnFemale.setBounds(319, 378, 103, 41); - frame.getContentPane().add(rdbtnFemale); - - JRadioButton rdbtnOther = new JRadioButton("Other"); - rdbtnOther.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) - { - gender="Other"; - } - }); - rdbtnOther.setFont(new Font("Tahoma", Font.BOLD, 16)); - rdbtnOther.setBounds(456, 378, 103, 41); - frame.getContentPane().add(rdbtnOther); - - JLabel lblNewLabel_6 = new JLabel("Profession"); - lblNewLabel_6.setFont(new Font("Tahoma", Font.BOLD, 16)); - lblNewLabel_6.setBounds(36, 460, 114, 26); - frame.getContentPane().add(lblNewLabel_6); - - textField_4 = new JTextField(); - textField_4.setBounds(187, 466, 342, 37); - frame.getContentPane().add(textField_4); - textField_4.setColumns(10); - - JLabel lblNewLabel_7 = new JLabel("DOB"); - lblNewLabel_7.setFont(new Font("Tahoma", Font.BOLD, 16)); - lblNewLabel_7.setBounds(35, 557, 101, 29); - frame.getContentPane().add(lblNewLabel_7); - JPanel panel = new JPanel(); - panel.setBounds(187, 557, 352, 63); - frame.getContentPane().add(panel); - - UtilDateModel model = new UtilDateModel(); - - model.setDate(20,04,2014); - Properties p = new Properties(); - p.put("text.today", "Today"); - p.put("text.month", "Month"); - p.put("text.year", "Year"); - JDatePanelImpl datePanel = new JDatePanelImpl(model, p); - - - JDatePickerImpl datePicker = new JDatePickerImpl(datePanel, new DateLabelFormatter() ); - panel.add(datePicker); - //String d = datePicker.getModel().getValue().toString(); - //System.out.println(d); - ButtonGroup G = new ButtonGroup(); - G.add(rdbtnNewRadioButton); - G.add(rdbtnFemale ); - G.add(rdbtnOther); - - JButton btnNewButton = new JButton("Rest"); - btnNewButton.setBounds(187, 630, 124, 41); - frame.getContentPane().add(btnNewButton); - - JButton btnPrint = new JButton("Print"); - btnPrint.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) - { - String textString=textField_3.getText(); - if(textString.length()>10) - {JOptionPane.showMessageDialog(textField_3,"Error Number must be Less 11");return ;} - - Name=textField.getText(); - // System.out.println("Nmae :"+Name); - mName=textField_1.getText(); - LName=textField_2.getText(); - String Adrress=textArea.getText(); - //System.out.println(Adrress); - String Number=textField_3.getText(); - String profession=textField_4.getText(); - JOptionPane.showMessageDialog(textField,"NAME :"+Name+" "+mName+" "+LName+"\n"+"Adress :"+Adrress+"\n"+"Number :"+Number+"\nProfession :"+profession+"DOB :"+datee); - - } - }); - btnPrint.setBounds(387, 630, 124, 41); - frame.getContentPane().add(btnPrint); - - - - } -} - -class DateLabelFormatter extends AbstractFormatter { - - private String datePattern = "yyyy-MM-dd"; - private SimpleDateFormat dateFormatter = new SimpleDateFormat(datePattern); - - @Override - public Object stringToValue(String text) throws ParseException { - return dateFormatter.parseObject(text); - } - - @Override - public String valueToString(Object value) throws ParseException { - if (value != null) { - Calendar cal = (Calendar) value; - return dateFormatter.format(cal.getTime()); - } - - return ""; - } - -} - diff --git a/OopsLab/src/Day11_Swing/package-info.java b/OopsLab/src/Day11_Swing/package-info.java deleted file mode 100644 index 73c9d61..0000000 --- a/OopsLab/src/Day11_Swing/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -package Day11_Swing; \ No newline at end of file diff --git a/OopsLab/src/Day6/Student.java b/OopsLab/src/Day6/Student.java deleted file mode 100644 index f79495d..0000000 --- a/OopsLab/src/Day6/Student.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * - */ -package Day6; -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class Student -{ - protected String name; - protected String reg; - protected String Age; - protected float marks; - public String project; - public String getAdd() { - return add; - } - - public void setAdd(String add) { - this.add = add; - } - - private String add; - protected String number; - - public String getNumber() { - return number; - } - - public void setNumber(String number) { - this.number = number; - } - -static ArrayList n=n=new ArrayList(); - public Student() - { - - } - - Student(String name, String reg, String age, float marks, String add, String number) - { - this.name = name; - this.reg = reg; - Age = age; - this.marks = marks%500; - this.add = add; - this.number = number; - } - - public void remark(){ - System.out.println("Nothing"); - } - - void getdata() - { - Student st=new Student("NAVEEN","19BCN7185","19",450,"RAM NAGAR GOA","6383128594"); - Student st1=new Student("PRAVEEN","19BCD7168","19",490,"TAMIL NADU","6383128515"); - n.add(st); - n.add(st1); - } - public static void main(String[] args) - { - Student s=new Student(); - } - -} - -class Employee -{ - protected String name; - protected String reg; - protected String age; - protected float Grade; - private String add; - private String number; - Employee(String name, String reg, String age, float grade, String add, String number) { - super(); - this.name = name; - this.reg = reg; - this.age = age; - Grade = grade; - this.add = add; - this.number = number; - } - - public static void main(String ...strings) - { - Student student =new Student(); - student.getdata(); - ArrayList n1=student.n; - Student s1=n1.get(0); - System.out.println(" student name : "+s1.name+" student number :"+s1.getAdd()); - } - -} - - diff --git a/OopsLab/src/Day6/exception_demo.java b/OopsLab/src/Day6/exception_demo.java deleted file mode 100644 index d4d55a9..0000000 --- a/OopsLab/src/Day6/exception_demo.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * - */ -package Day6; -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class exception_demo -{ - - public static void Arithmetic_exception(int a,int b) - { - try { int res=a/b; - System.out.println ("Result: "+res);} - catch(ArithmeticException e) - { - System.out.println("ArithmeticException caugth : b!=0"); - } - } - - public static void ArrayIndexOutOfBounds() { - try{ - String a[]=new String[50]; - - a[a.length] = "java"; - } - catch(ArrayIndexOutOfBoundsException e){ - System.out.println ("ArrayIndexOutOfBoundsException :ArrayIndexOutOfBounds"); - } - } - - public static void classnotfound() - { - try { - Class.forName("rhea"); - } catch (ClassNotFoundException e) { - - System.out.println("ClassNotFoundException :class not found"); - } - } - public static void number() - { - try{ - int num=Integer.parseInt (null) ; - System.out.println(num); - }catch(NumberFormatException e){ - System.out.println("NumberFormatException :Number format exception occurred"); - } - } - public static void nullpointer() - { try { - String naveen[]=null; - System.out.println(naveen[0].charAt(0)); - } - catch( NullPointerException e) - { - System.out.println(" NullPointerException :NullPointerException.."); - } - } - - public static void main(String ...strings) - { - nullpointer(); - classnotfound(); - number(); - ArrayIndexOutOfBounds(); - Arithmetic_exception(5,0); - - } -} - diff --git a/OopsLab/src/Day6/generics.java b/OopsLab/src/Day6/generics.java deleted file mode 100644 index cbdea4f..0000000 --- a/OopsLab/src/Day6/generics.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * - */ -package Day6; - -import java.util.Arrays; - -public class generics - { - public static void main(String[] args) - { - System.out.println("Enter the Number :"); - String t[]= {"naveen","balapraveen","baveen"}; - Array ar=new Array(t); - ar.Sort(t); - System.out.println(Arrays.toString(ar.mark)); - - } - - } - - class Array > - { Type mark[]; - Type temp; - int count=0; - Array( Type Marks[]) - { - mark=Marks; - } - public void put(Type i) - { - mark[count++]=(Type)i; - } - public Type[] Sort(Type Marks[]) - { - for(int i=0;il2 ) - { - temp=(Type) mark[j]; - mark[j]=mark[j+1]; - mark[j+1]= temp; - - } - else if(l1==l2) - { - Type t=(Type) mark[j]; - mark[j]=mark[j+1]; - mark[j+1]= (Type) t; - - } - } - } - - return (Type[]) mark; - } - } - - - - diff --git a/OopsLab/src/Day6/package-info.java b/OopsLab/src/Day6/package-info.java deleted file mode 100644 index 32a2ff6..0000000 --- a/OopsLab/src/Day6/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -package Day6; \ No newline at end of file diff --git a/OopsLab/src/Day9/Series.java b/OopsLab/src/Day9/Series.java deleted file mode 100644 index e6529b0..0000000 --- a/OopsLab/src/Day9/Series.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * - */ -package Day9; -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class Series -{ - - public Series() - { - - } - - public static void main(String[] args) - { - prints p=new prints(); - p.setName("TH1"); - p.start(); - printss p2=new printss(); - p2.setName("TH2"); - p2.start(); - } - -} - -class prints extends Thread{ - public void run() - { - System.out.println("--------------------Number's Divisble By 3-----------------------------------"); - int i=0; - while(true) - { if(i%3==0) - System.out.println(i); i++; - try { - Thread.sleep(fibo.getfibo()); - } catch (Exception e) { - System.out.println(e); - } - - } - } - - } - -class printss extends Thread{ - - public void run() - { - System.out.println("English Aplhabets circular----"); - int i=0; - while(true) - { - System.out.println("ALPHA :"+(char)(i+65)); - i++; - i=i%26; - try { - Thread.sleep(fibo.getfibo()); - } catch (Exception e) { - System.out.println(e); - } - } - - } -} - -class fibo{ - - public static int getfibo() - { Random r=new Random(); - - int n = r.nextInt(100), t1 = 0, t2 = 1; - - for (int i = 1; i <= n; ++i) - { - - int sum = t1 + t2; - t1 = t2; - t2 = sum; - } - return t2; - } -} diff --git a/OopsLab/src/Day9/package-info.java b/OopsLab/src/Day9/package-info.java deleted file mode 100644 index 1ae703e..0000000 --- a/OopsLab/src/Day9/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -package Day9; \ No newline at end of file diff --git a/OopsLab/src/Day9/parallel_tr.java b/OopsLab/src/Day9/parallel_tr.java deleted file mode 100644 index 50a8f70..0000000 --- a/OopsLab/src/Day9/parallel_tr.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * - */ -package Day9; -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class parallel_tr -{ - - public parallel_tr() - { - - } - - public static void main(String[] args) - { - print p= new print(); - p.setName("TH1"); - p.start(); - print p1=new print(); - p1.setName("TH2"); - - try { - p.join(); - p1.start(); - p1.join(); - } catch (InterruptedException e) { - - e.printStackTrace(); - } - - System.out.println("Parelle Threads-------------------------------------------------------->"); - print p3=new print(); - p3.setName("TH3"); - p3.start(); - print p4=new print(); - p4.setName("TH4"); - p4.start(); - - } - -} - -class print extends Thread -{ - public void run() - { - if(Thread.currentThread().getName().equalsIgnoreCase("TH1") ||Thread.currentThread().getName().equalsIgnoreCase("TH3")) - { System.out.println("----------------------------Prime Number's Zero to 100 ------------------------------------------------"); - for(int i=2;i<=100;i++) - { int flag=0; - //System.out.println("Number :"+i); - for(int j=2;j0) - { - num=num*10+n%10; - n=n/10; - - } - if(num==i) {System.out.println("Number is palindrome :"+i);} - } - } - - } -} diff --git a/OopsLab/src/Days8/Multithreadings.java b/OopsLab/src/Days8/Multithreadings.java deleted file mode 100644 index 00fbaa2..0000000 --- a/OopsLab/src/Days8/Multithreadings.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - */ -package Days8; -import java.io.FileInputStream; -import java.io.ObjectInputStream; -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class Multithreadings -{ - - public Multithreadings() - { - - } - - public static void main(String[] args) - { System.out.println("... Multithreading "); - new read().start(); - new vowels().start(); - System.out.println("... Multithreading is over "); - } - -} - -class read extends Thread -{ - public void run() - { - ObjectInputStream obj; - int n1; - String s[]; - try { - obj=new ObjectInputStream(new FileInputStream("output.ser")); - s=(String[]) obj.readObject(); - System.out.println(" serilzation Arrays :"+Arrays.toString(s)); - System.out.println("String Lenght More than 3>"); - for(int i=0;i3) - System.out.println(s[i]); - } - } - catch(Exception e) - { - e.printStackTrace(); - } - } -} - -class vowels extends Thread -{ - public void run() - { - ObjectInputStream obj; - String s[]; - try { - obj=new ObjectInputStream(new FileInputStream("output.ser")); - s=(String[]) obj.readObject(); - System.out.println(" serilzation Arrays :"+Arrays.toString(s)); - System.out.println("String Of Volwels>"); - for(int i=0;i0) {System.out.println(Arrays.toString(h));} - } - } - catch(Exception e) - { - e.printStackTrace(); - } - } - } - - diff --git a/OopsLab/src/Days8/ThreadSER.java b/OopsLab/src/Days8/ThreadSER.java deleted file mode 100644 index ac7cd51..0000000 --- a/OopsLab/src/Days8/ThreadSER.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * - */ -package Days8; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class ThreadSER -{ - - public ThreadSER() { - } - - public static void main(String[] args) - { System.out.println("... Multithreading "); - new ThreadSER().serializeObject(); - new sumABC().start(); - new rest().start(); - System.out.println("... Multithreading Over............"); - } - public void serializeObject() - { - try { - FileOutputStream f=new FileOutputStream("Output.txt"); - ObjectOutputStream obj=new ObjectOutputStream(f); - for(int i=0;i<10;i++) - { - obj.write(i); - } - obj.flush(); - obj.close(); - } - catch(Exception e) { - System.out.println(e.getClass().getName()); - } - } -} - -class sumABC extends Thread -{ - public void run() - { - ObjectInputStream obj; - ArrayList n=new ArrayList(); - int sum; - try { - obj=new ObjectInputStream(new FileInputStream("output.txt")); - System.out.println("Sum of 3>"); - for(int i=0;i<3;i++) - { - sum=obj.read(); - n.add(sum); - } - System.out.println(n); - int a=(Integer)n.get(0); - int b=(Integer)n.get(1); - int c=(Integer)n.get(2); - int avg=(int) ((a+b)/2.0)-(int) ((b+c)/2.0); - System.out.println("Result :"+(Math.abs(avg))); - } - catch(Exception e) - { - e.printStackTrace(); - } - } -} - -class rest extends Thread -{ - public void run() - { - ObjectInputStream obj; - ArrayList n=new ArrayList(); - int sum=0; - try { - obj=new ObjectInputStream(new FileInputStream("output.txt")); - System.out.println("Sum :"); - for(int i=0;i<10;i++) - { - sum=obj.read(); - n.add(sum); - } - for(int i=1;i16 - { - if (num==1 || num==0) - { - return 1; - } - return num*findfact(num-1); - - } - public static void main(String[] args) - { - System.out.println("Enter the To find Factorial :"); - int r=nav.nextInt(); - long factorial= new Recursive(r).findfact(r); - System.out.println("Factorial of Given number "+r+" is :"+factorial); - } - -} - diff --git a/OopsLab/src/ReverseString.java b/OopsLab/src/ReverseString.java deleted file mode 100644 index 714d88b..0000000 --- a/OopsLab/src/ReverseString.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - */ -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class ReverseString -{ private String str,output; - static Scanner nav=new Scanner(System.in); - public ReverseString(String str) - { - this.str=str; - output=""; - } - public String reverse(String str) - { - String s[]=str.split(""); - System.out.println("Initial String :"+Arrays.toString(s)); - for(int i=s.length -1;i>=0;i--) - { - output=output+s[i]; - } - //System.out.println(output); - output=output+" "; - return output; - } - public static void main(String ...strings) - { - System.out.println("Enter the String to find reverse"); - String a=nav.nextLine(); - ReverseString rs=new ReverseString(a); - String temp[]=a.split(" "); - for(int i=temp.length-1;i>=0;i--) - rs.reverse(temp[i]); - System.out.println("Reverse String :"+rs.output); - } - -} - diff --git a/OopsLab/src/SubStrings.java b/OopsLab/src/SubStrings.java deleted file mode 100644 index 0b5debc..0000000 --- a/OopsLab/src/SubStrings.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * - */ -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class SubStrings -{ String str; - ArrayList n=new ArrayList<>(); - static Scanner nav=new Scanner(System.in); - public SubStrings(String str) - { - this.str=str; - } - - public void Substr() - { - for(int i=0;i=97) - { - st[i]=(char)((int)st[i]-32); - } - - } - System.out.println(Arrays.toString(st)); - - } - - public void ToLowerCase() - { //str=str.toUpperCase(); - char st[]=str.toCharArray(); - for(int i=0;i=65) - { - st[i]=(char)((int)st[i]+32); - } - - } - System.out.println(Arrays.toString(st)); - - } - public static void main(String[] args) - { - System.out.println(" Enter a String :"); - String s=nav.nextLine(); - SubStrings temp=new SubStrings(s); - - while(true) - { - System.out.println("1)SubString \n2)TOupperCase \n3)TOlowerCase \n4)Exit()"); - switch(nav.nextInt()) - { - case 1: temp.Substr(); - break; - case 2:temp.UpperCase(); - break; - case 3: temp.ToLowerCase(); - break; - case 4:System.exit(0); - } - } - } - -} - diff --git a/OopsLab/src/day2/Area_shapes.java b/OopsLab/src/day2/Area_shapes.java deleted file mode 100644 index 608a8c9..0000000 --- a/OopsLab/src/day2/Area_shapes.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * - */ -package day2; - -import java.util.Scanner; - -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class Area_shapes -{ - private double area,cir; - public Area_shapes() - { - area=0;cir=0; - } - - public Area_shapes(double side) - { - area=side*side; - cir=4*side; - } - - public Area_shapes(double h,double w) - { - area=h*w; - cir=2*(h+w); - } - public Area_shapes(double h,double b,double c) - { - area=(0.5)*(h*b); - cir=h+b+c; - } - public static void main(String[] args) - { Scanner nav=new Scanner(System.in); - System.out.println("enter the Sides of Square to find Area"); - Area_shapes s=new Area_shapes(nav.nextDouble()); - System.out.println("Area of Squre is :"+s.area +"circumference :"+s.cir); - System.out.println("enter the Sides of Rectangle to find Area"); - Area_shapes rect=new Area_shapes(nav.nextDouble(),nav.nextDouble()); - System.out.println("Area of Rectangle is :"+rect.area +"circumference :"+rect.cir); - System.out.println("enter the Sides of Tirangle to find Area"); - Area_shapes tri=new Area_shapes(nav.nextDouble(),nav.nextDouble(),nav.nextDouble()); - System.out.println("Area of Rectangle is :"+tri.area +"circumference :"+tri.cir); - - - } - -} - - - diff --git a/OopsLab/src/day2/final_shapes.java b/OopsLab/src/day2/final_shapes.java deleted file mode 100644 index d02d9db..0000000 --- a/OopsLab/src/day2/final_shapes.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - */ -package day2; - -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -/* -public class final_shapes -{ - final int area=100; - public void dis() - { - - } - public final void display_area(){ - System.out.println("Hello welcome to Tutorialspoint"); - area =101; //The final field final_shapes.area cannot be assigned - } - public static void main(String args[]){ - new final_shapes().display_area(); - } -} - - class rectangle extends final_shapes - { - public void display_area() - { - System.out.println("Can not overidde the display_area due to final keyword"); - } - - public void dis() - { - System.out.println("Overriden by sub class"); - } - } - -*/ \ No newline at end of file diff --git a/OopsLab/src/day2/package-info.java b/OopsLab/src/day2/package-info.java deleted file mode 100644 index eed7bc9..0000000 --- a/OopsLab/src/day2/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -package day2; \ No newline at end of file diff --git a/OopsLab/src/day2/prime_number.java b/OopsLab/src/day2/prime_number.java deleted file mode 100644 index ac205a3..0000000 --- a/OopsLab/src/day2/prime_number.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - */ -package day2; -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class prime_number -{ - private int num; - public prime_number(int num) - { - this.num=num; - } - - private boolean checkprime() - { - if(num<=1) - return false; - else - { - for(int i=2;i vol=new ArrayList(); - String s; - public volews(String input) - { int vowels=0; - char str[]=input.toCharArray(); - for(int i=0;i= '0' && str[i] <= '9') - { String temp=str[i]+""; - sum=sum+Integer.parseInt(temp); - } - } - System.out.println("All the Sum of Digits in String :"+sum); - } - - public static void main(String ...strings) - { - Scanner nav=new Scanner(System.in); - System.out.println("Enter the String :"); - String in=nav.nextLine(); - volews v=new volews(in); - volews ch=new volews(in.toCharArray()); - } - -} - diff --git a/OopsLab/src/day3/University.java b/OopsLab/src/day3/University.java deleted file mode 100644 index 53a4c01..0000000 --- a/OopsLab/src/day3/University.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * - */ -package day3; -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class University extends staff -{ - - public University() - { - super(); - } - public University(String Professor_Grade,String technical_staffs_Grade,String name,String type,String Group,String period) - { - super(Professor_Grade,technical_staffs_Grade,name,type,Group,period); - } - public static void main(String[] args) - { - University un=new University(); - //System.out.println("======"+un.Professor_Grade+" "+un.technical_staffs_Grade+" "+un.type+" "+un.period+" "+un.name); - University un2=new University(); - System.out.println("Professor_Grade :"+un2.Professor_Grade+"\ntechnical_staffs_Grade :"+un2.technical_staffs_Grade+"\nStudent Name :"+un.name+"\nStudent Gruop :"+un2.Group); - System.out.println("Student Couse :"+un2.type+"\nStudent couse Period :"+un2.period); - - System.out.println("<======================Custome input===============================> Univerity Class"); - University un3=new University("Associate","A","NAVEEN","B.TECH","CSE","8"); - System.out.println("Professor_Grade :"+un3.Professor_Grade+"\ntechnical_staffs_Grade :"+un3.technical_staffs_Grade+"\nStudent Name :"+un3.name+"\nStudent Gruop :"+un3.Group); - System.out.println("Student Couse :"+un3.type+"\nStudent couse Period :"+un3.period); - - System.out.println("<========= STAFF Class and University Constructor====================================>"); - staff st=new University("Associate","B","Rhea","B.TECH","EEE","8"); - System.out.println("Professor_Grade :"+st.getProfessor_Grade()+"\ntechnical_staffs_Grade :"+st.getTechnical_staffs_Grade()+"\nStudent Name :"+st.getName()+"\nStudent Gruop :"+st.getGroup()); - System.out.println("Student Couse :"+st.getType()+"\nStudent couse Period :"+st.getPeriod()); - st.setGroup("CSE"); - System.out.println("Modified Gruop of "+st.name +" :"+st.getGroup()); - } - -} - -class staff extends program -{ - String Professor_Grade; - public String getProfessor_Grade() - { System.out.println("Get the Professor_Grade"); - return Professor_Grade; - } - public void setProfessor_Grade(String professor_Grade) - { System.out.println("Set the Professor_Grade"); - Professor_Grade = professor_Grade; - } - public String getTechnical_staffs_Grade() - { System.out.println("Get the Technical_staffs_Grade"); - return technical_staffs_Grade; - } - public void setTechnical_staffs_Grade(String technical_staffs_Grade) - { System.out.println("Set the Technical_staffs_Grade"); - this.technical_staffs_Grade = technical_staffs_Grade; - } - String technical_staffs_Grade; - staff() - { - Professor_Grade="Assistant"; - technical_staffs_Grade="C"; - } - - staff(String Professor_Grade,String technical_staffs_Grade) - { super(); - this.Professor_Grade = Professor_Grade; - this.technical_staffs_Grade=technical_staffs_Grade; - - } - - staff(String Professor_Grade,String technical_staffs_Grade,String name,String type,String Group,String period) - { - super(Group,type,period,name); - this.Professor_Grade = Professor_Grade; - this.technical_staffs_Grade=technical_staffs_Grade; - - } -} - -class program -{ String name; - String type; - String Group; - String period; - public String getName() { - return name; -} -public void setName(String name) { - this.name = name; -} - - public String getGroup() { - return Group; - } - public void setGroup(String group) { - Group = group; - } - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - public String getPeriod() { - return period; - } - public void setPeriod(String period) { - this.period = period; - } - program() - { - type="M.TECH"; - Group="ECE"; - period="4"; - name=" "; - } - program(String Group,String type,String period,String name) - { - this.period = period; - this.type = type; - this.Group = Group; - this.name = name; - } - -} diff --git a/OopsLab/src/day3/Vehicle.java b/OopsLab/src/day3/Vehicle.java deleted file mode 100644 index f9e1d88..0000000 --- a/OopsLab/src/day3/Vehicle.java +++ /dev/null @@ -1,129 +0,0 @@ -/** - * - */ -package day3; -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class Vehicle extends owner -{ - private String type; - private String reg; - private String size,work; - public String getSize() { - return size; -} - -public void setSize(String size) { - this.size = size; -} - -public String getWork() { - return work; -} - -public void setWork(String work) { - this.work = work; -} - -public String getType() { - return type; -} - -public void setType(String type) { - this.type = type; -} - -public String getReg() { - return reg; -} - -public void setReg(String reg) { - this.reg = reg; -} - public Vehicle() - { - type=""; - reg=""; - } - - public Vehicle(String type ,String reg) - { - super(); - this.type=type; - this.reg=reg; - } - public Vehicle(String type ,String reg,String size,String work,String name,String add) - { - super(name,add); - this.type=type; - this.reg=reg; - this.size=size; - this.work=work; - } - public static void main(String[] args) - { - Vehicle v=new Vehicle("two wheeler","GA05AF4567","Medium","travelling","Naveen","Ram Nager Goa") ; - System.out.println("Type of vehicle :"+v.type+"\n reg number :"+v.reg); - System.out.print(" vehicle drive :"); - v.drive(); - System.out.print(" vehicle purpose :"); - v.purpose(); - System.out.print(" vehicle Size :"); - v.size(); - System.out.print(" vehicle Strucuture :"); - v.structure(); - - } - - public void drive() - { - System.out.println("Way to drive long or short"); - - } - public void structure() - { - System.out.println("metal and carbon fiber"); - } - - public void purpose() - { - System.out.println("Purpose is for "+work); - } - public void size() - { - System.out.println("SIZE OF THE Vehicle is "+size); - } - -} - -class owner{ - public String name; - public String add; - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getAdd() { - return add; - } - public void setAdd(String add) { - this.add = add; - } - - owner() - { - name=""; - add=""; - } - owner(String name,String add) - { - this.name=name; - this.add=add; - } -} diff --git a/OopsLab/src/day3/package-info.java b/OopsLab/src/day3/package-info.java deleted file mode 100644 index 08a4622..0000000 --- a/OopsLab/src/day3/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -package day3; \ No newline at end of file diff --git a/OopsLab/src/day4/package-info.java b/OopsLab/src/day4/package-info.java deleted file mode 100644 index bab87ca..0000000 --- a/OopsLab/src/day4/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -package day4; \ No newline at end of file diff --git a/OopsLab/src/day4/transportation.java b/OopsLab/src/day4/transportation.java deleted file mode 100644 index b0089a5..0000000 --- a/OopsLab/src/day4/transportation.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * - */ -package day4; -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class transportation -{ - int price; - int pricekg; - Object obj; - int total=0; - public transportation() - { - - } - - public transportation(bus b,int number,int price) - { - b.number=number; - this.price=price; - this.pricekg=0; - sum(number,0,price,0); - } - public transportation(cars c,int number,int price) - { - c.number=number; - this.price=price; - this.pricekg=0; - sum(number,0,price,0); - } - public transportation(truck t,int numberkg,int price) - { - t.numberkg=numberkg; - this.price=0; - this.pricekg=price; - sum(numberkg,0,price,0); - } - public transportation(ship sp,int number,int numberkg,int price,int pricekg) - { - sp.number=number; - sp.numberkg=numberkg; - this.price=price; - this.pricekg=pricekg; - sum(number,numberkg,price,pricekg); - } - - public transportation(flight f,int number,int numberkg,int price,int pricekg) - { - f.number=number; - f.numberkg=numberkg; - this.price=price; - this.pricekg=pricekg; - sum(number,numberkg,price,pricekg); - } - - public void sum(int number,int numberkg,int price,int pricekg) - { - total=price*number +pricekg*numberkg; - System.out.println("flare of :"+number+" people "+" number of kg :"+numberkg+" price per head :"+price+" price per kg :"+pricekg+" Total"+total); - } - public static void main(String[] args) - { System.out.println("Bus"); - transportation bt=new transportation (new bus(),5,500); - System.out.println("CARS"); - transportation car=new transportation (new cars(),3,1000); - System.out.println("TRUCKS"); - transportation truck=new transportation (new truck(),3,1000); - System.out.println("SHIP"); - transportation ship=new transportation (new ship(),3,5,1000,500); - System.out.println("FLIGTH"); - transportation f=new transportation (new flight(),3,15,100,500); - } - -} - -class bus { - String function="people" ; - int number=0; - -} -class cars{ - String function="people" ; - int number=0; - -} -class truck{ - String function="Load" ; - int numberkg=0; -} -class ship{ - String function="Both" ; - int number=0; - int numberkg=0; - -} -class flight{ - String function="Both" ; - int number=0; - int numberkg=0; - -} diff --git a/OopsLab/src/day4/woodsales.java b/OopsLab/src/day4/woodsales.java deleted file mode 100644 index 89793b5..0000000 --- a/OopsLab/src/day4/woodsales.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * - */ -package day4; -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class woodsales { - - public woodsales() { - - } - - public static void main(String[] args) - { - - // father f=new father(); - father f=new father(500,100,1.8f,2); - f.cal(); - f.cal_profit(); -System.out.println(" profit :"+f.profit+" raw wood cost :"+f.raw_wood_cost+" making_charges :"+f.making_charges+" size : ("+f.w+" ,"+f.h+")"); - System.out.println("Cost of production :"+f.cost_of_pro); - - son s=new son(500,100,3.8f,2); - s.cal(); - s.cal_profit(); - s.discount(); - System.out.println(" profit :"+s.profit+" raw wood cost :"+s.raw_wood_cost+" making_charges :"+s.making_charges+" size : ("+s.w+" ,"+s.h+")"); - System.out.println("Cost of production :"+s.cost_of_pro +" Discount :"+s.dicount); - } - - -} - -class father{ - - static float profit; - float raw_wood_cost; - float making_charges; - float w,h; - float cost_of_pro; - father() - { - profit=0; - raw_wood_cost=0; - making_charges=0; - w=0; - h=0; - cost_of_pro=0; - } - - father(float cost,float charges,float w,float h) - { - raw_wood_cost=cost; - making_charges=charges; - if(w%1==0) - this.w=w; - else - this.w=((int)w/1)+1; - if(h%1==0) - this.h=h; - else - this.h=((int)w/1)+1; - cost_of_pro=0; - } - - public static float getProfit() { - return profit; - } - public static void setProfit(float profit) { - father.profit = profit; - } - public float getRaw_wood_cost() { - return raw_wood_cost; - } - public void setRaw_wood_cost(float raw_wood_cost) { - this.raw_wood_cost = raw_wood_cost; - } - public float getMaking_charges() { - return making_charges; - } - public void setMaking_charges(float making_charges) { - this.making_charges = making_charges; - } - public float getW() { - return w; - } - public void setW(float w) { - this.w = w; - } - public float getH() { - return h; - } - public void setH(float h) { - this.h = h; - } - public float getCost_of_pro() { - return cost_of_pro; - } - public void setCost_of_pro(float cost_of_pro) { - this.cost_of_pro = cost_of_pro; - } - - public float cal() - { - cost_of_pro=(raw_wood_cost*(w*h)+making_charges ); - return cost_of_pro; - } - - public float cal_profit() - { - return profit=profit+cost_of_pro; - } -} - -class son extends father -{ float dicount =0; - son() - { - super(); - } - - son(float cost,float charges,float w,float h) - { - super(cost,charges,w,h); - super.w=w; - super.h=h; - } - - public float cal() - { - cost_of_pro=raw_wood_cost*(w*h)+making_charges; - return cost_of_pro; - } - public float cal_profit() - { - return profit=profit+cost_of_pro; - } - public float discount() - { - if(w*h<=10) - { - dicount=super.cost_of_pro/10; - } - if(w*h>10) - { - dicount=super.cost_of_pro/15; - } - profit=profit-dicount; - return dicount; - } - -} - diff --git a/OopsLab/src/day5/String_Sort.java b/OopsLab/src/day5/String_Sort.java deleted file mode 100644 index 90774ca..0000000 --- a/OopsLab/src/day5/String_Sort.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * - */ -package day5; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class String_Sort -{ - static ArrayList list=new ArrayList(); - public String_Sort() - { - - } - - public static void main(String[] args) - { - - System.out.println("Enter the String to Sort :"); - - list.add("development"); - list.add("Development"); - list.add("aa"); - list.add("AA"); - list.add("Aa"); - list.add("55"); - System.out.println("String :"+list); - Collections.sort(list); - System.out.println("Sorted Array :"); - System.out.println(list); - len(); - find("AA"); - - } - - public static void find(Object i) - { - if(list.contains(i)) - { - System.out.println("String Conatians in "+":"+i); - } - - } - public static void len() - { - Map map=new LinkedHashMap(); - for(String s:list) - { - int l=s.length(); - map.put(s,l+""); - } - System.out.println(" string length :"); - System.out.println(map); - - } - -} - diff --git a/OopsLab/src/day5/package-info.java b/OopsLab/src/day5/package-info.java deleted file mode 100644 index 2a8aa04..0000000 --- a/OopsLab/src/day5/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -package day5; \ No newline at end of file diff --git a/OopsLab/src/day5/soting_generic.java b/OopsLab/src/day5/soting_generic.java deleted file mode 100644 index 868ac2c..0000000 --- a/OopsLab/src/day5/soting_generic.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * - */ -package day5; - -import java.util.Arrays; - -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class soting_generic { - - - public static < Number > void printArray( Number[] arr ) - { - for(Number element : arr) { - System.out.printf("%s ", element); - } - System.out.println(); - - } - - public static void main(String[] args) - { Integer x[]= {1,2,9,4,5}; - int t[]= {2,5,7,9}; - Integer[] intArray = { 1, 2, 3, 4, 5 }; - Double[] doubleArray = { 1.1, 2.2, 4.4 , 3.3}; - Float[] Array = { 1.1f, 2.2f, 4.4f , 3.3f}; - - System.out.println("Array integerArray contains:"); - printArray(intArray); - cal n=new cal(x); - n.sorting(); - System.out.println("\nArray doubleArray contains:"); - printArray(doubleArray); - cal n2=new cal(doubleArray); - n2.sorting(); - - System.out.println("\nArray Float contains:"); - printArray(Array); - cal n3=new cal(Array); - n3.sorting(); - - System.out.println("========================Merger Sort================================"); - cal n4=new cal(); - int res[]=n4.mergeSort(t, t.length); - System.out.println(Arrays.toString(res)); - } - -} - -class cal -{ sort obj[]; - cal(sort[] obj) - { - this.obj=obj; - } - cal() - { - - } - public void sorting() - { - for(int i=0;iobj[j+1].doubleValue()) - { - sort temp = obj[j]; - obj[j] = obj[j+1]; - obj[j+1] = temp; - } - } - } - System.out.println(Arrays.toString(obj)); - } - public int[] mergeSort(int[] a, int n) { - if (n < 2) { - return a; - } - int mid = n / 2; - int[] l = new int[mid]; - int[] r = new int[n - mid]; - - for (int i = 0; i < mid; i++) { - l[i] = a[i]; - } - for (int i = mid; i < n; i++) { - r[i - mid] = a[i]; - } - mergeSort(l, mid); - mergeSort(r, n - mid); - - merge(a, l, r, mid, n - mid); - return a; - } - public static int[] merge( - int[] a, int[] l, int[] r, int left, int right) { - - int i = 0, j = 0, k = 0; - while (i < left && j < right) { - if (l[i] <= r[j]) { - a[k++] = l[i++]; - } - else { - a[k++] = r[j++]; - } - } - while (i < left) { - a[k++] = l[i++]; - } - while (j < right) { - a[k++] = r[j++]; - } - return a; - } - -} - diff --git a/OopsLab/src/day7/CreateUser.java b/OopsLab/src/day7/CreateUser.java deleted file mode 100644 index edea420..0000000 --- a/OopsLab/src/day7/CreateUser.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - */ -package day7; - -import java.util.InputMismatchException; -import java.util.Scanner; - -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class CreateUser { - - public String getNumber() { - return number; - } - - public void setNumber(String number) { - this.number = number; - } - public String number; - static Scanner nav=new Scanner(System.in); - - public CreateUser() - { - - } - - public void val() - { - System.out.println("Enter the number :"); - number=nav.next(); - - } - public void length() - { - String s=number+""; - String temp[]=s.split(""); - if(s.length()>=10) - { if(s.length()==11) - { - if(!temp[0].equals("0")) - { - throw new ArithmeticException("The First LEtter should be Zero :"); - - } - } - if(s.length()==12) - { - if(!(temp[0].equals("9") && temp[1].equals("1")) ) - { - throw new ArithmeticException("The First LEtter should not be 9 and Second Must be 1 :"); - } - } - if(s.length()>=13) - { - if(!(temp[0].equals("0") && temp[1].equals("9") && temp[2].equals("1")) ) - throw new ArithmeticException("The Number Must be Less Than 13 :"); - } - - - else {System.out.println("Number is valid :"+number);}} - } -public static void main(String[] args) -{ CreateUser c=new CreateUser(); - c.val(); - - while(true) { - try { - c.length(); - System.out.println("Done "); - break; - } - catch(ArithmeticException e) - { - System.out.println("Exception catugth -> :"+e.getMessage()); - c.setNumber(nav.next()); - //c.length(); - } - } -} - -} - diff --git a/OopsLab/src/day7/Ingnore.java b/OopsLab/src/day7/Ingnore.java deleted file mode 100644 index a715606..0000000 --- a/OopsLab/src/day7/Ingnore.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * - */ -package day7; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class Ingnore -{ - int sum; - int a,b; - int array[]=new int[10]; - public Ingnore() - { sum=0; - a=0; - b=0; - - } -public void sum(int a) throws ArithmeticException -{ - sum=a/b; - System.out.println(sum); -} - -public void array() throws ArrayIndexOutOfBoundsException -{ - for(int i=0;i<=array.length;i++) - { - array[i]=i; - } -} - -public void serializeObject() -{ String a[]= {"naveen","Bala","Praveen","Hi","Hel","FVV"}; - try { - FileOutputStream f=new FileOutputStream("Output.ser"); - ObjectOutputStream obj=new ObjectOutputStream(f); - //obj.write(sum); - obj.writeObject(a); - //obj.writeUTF(Arrays.toString(array)); - obj.flush(); - obj.close(); - } - catch(Exception e) { - System.out.println(e.getClass().getName()); - } -} - public static void main(String[] args) - { - Ingnore v=new Ingnore(); - try { - v.sum(4);} - catch(ArithmeticException e) - { - System.out.println("Sum not possible (a+b)"); - } - - try { - v.array(); - } - catch(ArrayIndexOutOfBoundsException e) - { - System.out.println("Array out of bounds"); - } - - v.serializeObject(); - v.read(); - } - - private void read() - { ObjectInputStream obj; - int n1; - String s[]; - try { - obj=new ObjectInputStream(new FileInputStream("output.ser")); - n1=obj.read(); - System.out.println(" serilzation Sum :"+n1); - s=(String[]) obj.readObject(); - System.out.println(" serilzation Arrays :"+Arrays.toString(s)); - } - catch(Exception e) - { - e.printStackTrace(); - } - - } - -} - diff --git a/OopsLab/src/day7/Validations.java b/OopsLab/src/day7/Validations.java deleted file mode 100644 index 05556e9..0000000 --- a/OopsLab/src/day7/Validations.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * - */ -package day7; -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class Validations -{ public int number; - static Scanner nav=new Scanner(System.in); - - public void Validate() throws InputMismatchException - { System.out.println("Enter the number :"); - number=nav.nextInt(); - length(); - } - - public void length() - { - String s=number+""; - String temp[]=s.split(""); - if(s.length()<=10) - { - throw new ArithmeticException("Phone Number Must be Less Than 10 :"); - } - if(s.length()==11) - { - if(!temp[0].equals("0")) - { - throw new ArithmeticException("The First LEtter should not be Zero :"); - } - } - if(s.length()==12) - { - if(!(temp[0].equals("9") && temp[1].equals("1")) ) - { - throw new ArithmeticException("The First LEtter should not be Zero :"); - } - } - if(s.length()==13) - { - - throw new ArithmeticException("The Number Must be Less Than 13 :"); - } - } - public static void main(String[] args) - { - Validations v=new Validations(); - } - -} - diff --git a/OopsLab/src/day7/check.java b/OopsLab/src/day7/check.java deleted file mode 100644 index 2ee57e9..0000000 --- a/OopsLab/src/day7/check.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - */ -package day7; - -import java.util.InputMismatchException; -import java.util.Scanner; - -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class check { - public String number; - static Scanner nav=new Scanner(System.in); - - public check() - { - System.out.println("Enter the number :"); - number=nav.next(); - length(); - } - - public void length() - { - String s=number+""; - String temp[]=s.split(""); - if(s.length()>=10) - { if(s.length()==11) - { - if(!temp[0].equals("0")) - { - throw new ArithmeticException("The First LEtter should not be Zero :"); - - } - } - if(s.length()==12) - { - if(!(temp[0].equals("9") && temp[1].equals("1")) ) - { - throw new ArithmeticException("The First LEtter should not be Zero :"); - } - } - if(s.length()==13) - { - - throw new ArithmeticException("The Number Must be Less Than 13 :"); - } - throw new ArithmeticException("Phone Number Must be Less Than 10 :"); - } - - else {System.out.println("Number is valid :"+number);} - } - public static void main(String[] args) - { - try{check v=new check();} - catch(InputMismatchException e) {System.out.println(e.getClass().getName());} - } -} - diff --git a/OopsLab/src/day7/package-info.java b/OopsLab/src/day7/package-info.java deleted file mode 100644 index 0b477ea..0000000 --- a/OopsLab/src/day7/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -package day7; \ No newline at end of file diff --git a/Q_AND_ANS/.classpath b/Q_AND_ANS/.classpath deleted file mode 100644 index 4f2c72b..0000000 --- a/Q_AND_ANS/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/Q_AND_ANS/.project b/Q_AND_ANS/.project deleted file mode 100644 index 3d5e938..0000000 --- a/Q_AND_ANS/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - FATQ - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/Q_AND_ANS/src/Employee.java b/Q_AND_ANS/src/Employee.java deleted file mode 100644 index c1ce66b..0000000 --- a/Q_AND_ANS/src/Employee.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * - */ -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class Employee -{ - private String name; - private int id; - public Employee(String name, int id) - { - - this.name = name; - this.id = id; - } - - public String getName() { - return name; -} - -public int getId() { - return id; -} - -public String toString() - { - return "Name :"+name+"\nId :"+id; - } - public static void main(String ...strings) - { - Employee e1; - PartTimeEmployee pe=new PartTimeEmployee("NAVEEN",5,10.0d); - pe.calulateSalary(5);//number of hours - e1=pe; - System.out.println(e1); - - FullTimeEmployee fe=new FullTimeEmployee("praveen",6,60d); - fe.calulateSalary(5); //number of Days - e1=fe; - System.out.println(e1); - } - -} - -class PartTimeEmployee extends Employee -{ - private double salary,hourlyRate; - -public PartTimeEmployee(String name, int id, double hourlyRate) { - super(name, id); - this.hourlyRate = hourlyRate; -} - public double calulateSalary(int numberofHours) - { - salary=numberofHours*hourlyRate; - return salary; - } - public String toString() - { - return "Name :"+super.getName()+"\nId :"+super.getId()+"\nHourly Rate :"+hourlyRate+"\nsalary :"+salary+"\n"; - } -} - - -class FullTimeEmployee extends Employee -{ - - - private double salary,weeklyPayRate; - - public FullTimeEmployee(String name, int id, double weeklyPayRate) { - super(name, id); - - this.weeklyPayRate = weeklyPayRate; - } - - public double calulateSalary(int numberofDays) - { - salary=numberofDays*weeklyPayRate; - return salary; - } - public String toString() - { - return "Name :"+super.getName()+"\nId :"+super.getId()+"\nWeekly Pay Rate :"+weeklyPayRate+"\nsalary :"+salary+"\n"; - } - -} diff --git a/Q_AND_ANS/src/Main.java b/Q_AND_ANS/src/Main.java deleted file mode 100644 index cebb446..0000000 --- a/Q_AND_ANS/src/Main.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * - */ -import java.util.*; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class Main { - - public static void main(String[] args) - { - bank customer1=new bank(1000); - Customer c1=new Customer(customer1); - Customer c2=new Customer(customer1); - Thread t1=new Thread(c1); - Thread t2=new Thread(c2); - t1.start(); - t2.start(); - } - -} - - -class Customer implements Runnable{ - bank b; - Scanner nav=new Scanner (System.in); - public Customer(bank b) - { - this.b=b; - } - - public void run() { - System.out.println("Enter the Amount to Withdraw :"); - b.withdraw(nav.nextInt()); - } - -} - -class bank -{ int balances; - Scanner nav=new Scanner (System.in); - bank(int amount) - { - balances=amount; - } - - public synchronized void withdraw(int amount) - { if(amount>balances) { - System.out.println("Money not Sufficent !! Deposit Money to Withdraw Money!!"); - deposit(amount); - - - - } - balances=balances-amount; - - System.out.println("Amount Balance"+Thread.currentThread().getName()+" :"+balances); - } - - public synchronized void deposit(int needmoney) - { System.out.println("Enter the Amount to Your Account :"); - int newamount=nav.nextInt(); - balances=balances+newamount; - - if(balances=2000 && salesman_amount<=5000 ) {commission =(10.0/100.0)*salesman_amount; return commission;} - else - commission =(12.0/100.0)*salesman_amount; return commission; - } - public String toString() - { - return " Salesman Name :"+name+"\nSalesman Code :"+salesman_code+"\nSalesman Amount :"+salesman_amount+"\nCommission :"+commission+"\n"; - } - - //getter setter are not must but its good practise - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getSalesman_code() { - return salesman_code; - } - public void setSalesman_code(String salesman_code) { - this.salesman_code = salesman_code; - } - public int getSalesman_amount() { - return salesman_amount; - } - public void setSalesman_amount(int salesman_amount) { - this.salesman_amount = salesman_amount; - } - public static void main(String ...strings) - { Salesman s1=new Salesman("Naveen","STD1005",1500); - System.out.println(s1.calcommission()); - System.out.println(s1); - Salesman s2=new Salesman("Sharma","STD1007",4500); - System.out.println(s2.calcommission()); - System.out.println(s2); - - Salesman s3=new Salesman("Rhea","STD10098",6000); - System.out.println(s3.calcommission()); - System.out.println(s3); - - } - -} - diff --git a/Q_AND_ANS/src/TaxSystem.java b/Q_AND_ANS/src/TaxSystem.java deleted file mode 100644 index e9cbcd9..0000000 --- a/Q_AND_ANS/src/TaxSystem.java +++ /dev/null @@ -1,121 +0,0 @@ -import java.awt.EventQueue; -import java.awt.event.*; -import java.util.HashMap; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; - -import java.awt.Font; -import javax.swing.JTextField; -import javax.swing.JButton; -import javax.swing.JPasswordField; - -/** - * - */ - -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class TaxSystem { - - private JFrame frame; - private JTextField userName; - private JPasswordField passwordField; - - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - TaxSystem window = new TaxSystem(); - window.frame.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - public TaxSystem() { - initialize(); - } - - private void initialize() { - HashMap map=new HashMap(); - map.put("Naveen", "123456789"); - map.put("Praveen","963852741"); - map.put("Rhea", "789456123"); - map.put("Thilak","741852963"); - System.out.println(map); - frame = new JFrame(); - frame.setTitle("Please Enter Name and Password"); - frame.setBounds(100, 100, 450, 300); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.getContentPane().setLayout(null); - - JLabel name = new JLabel("Name :"); - name.setFont(new Font("Tahoma", Font.BOLD, 16)); - name.setBounds(53, 65, 96, 29); - frame.getContentPane().add(name); - - JLabel password = new JLabel("Password :"); - password.setFont(new Font("Tahoma", Font.BOLD, 16)); - password.setBounds(53, 133, 96, 29); - frame.getContentPane().add(password); - - userName = new JTextField(); - userName.setBounds(188, 67, 184, 29); - frame.getContentPane().add(userName); - userName.setColumns(10); - passwordField = new JPasswordField(); - passwordField.setBounds(188, 133, 184, 29); - frame.getContentPane().add(passwordField); - frame.setTitle("Please Enter Name and Password"); - JButton submit = new JButton("Ok\r\n"); - submit.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 16)); - submit.setBounds(150, 194, 96, 36); - - submit.addActionListener(new ActionListener () { - - @Override - public void actionPerformed(ActionEvent e) { - try { - if(map.get(userName.getText()).equals(passwordField.getText())) - { - JOptionPane.showMessageDialog(submit,"Login Successfull!!!"); - newFrame nf=new newFrame(); - nf.setVisible(true); - - } - else - JOptionPane.showMessageDialog(submit,"Login Failed Invalid Username and Password!!"); - - } - catch(NullPointerException f1) {JOptionPane.showMessageDialog(submit,"Login Failed Invalid Username and Password!!"); //usename is not in HashMap - } - } - }); - frame.getContentPane().add(submit); - - - JButton cancel = new JButton("Cancel\r\n"); - cancel.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent arg0) { - frame.dispose(); - - } - - }); - cancel.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 16)); - cancel.setBounds(260, 194, 96, 36); - frame.getContentPane().add(cancel); - - - } -} - diff --git a/Q_AND_ANS/src/in/exam/ice/IceCream.java b/Q_AND_ANS/src/in/exam/ice/IceCream.java deleted file mode 100644 index 0a82058..0000000 --- a/Q_AND_ANS/src/in/exam/ice/IceCream.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * - */ -package in.exam.ice; - -import in.exam.util.*; -import java.util.Scanner; - -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class IceCream { - - - private String flavor; - private int scoops; - private final double PRICE_PER_SCOOP;//PRICE_PER_SCOOP=25 so fine - - - public IceCream() { - super(); - PRICE_PER_SCOOP = 25d; - } - - - public String getFlavor() { - return flavor; - } - - - public void setFlavor(String flavor) { - this.flavor = flavor; - } - - - public int getScoops() { - return scoops; - } - - - public void setScoops(int scoops) { - this.scoops = scoops; - } - - public double getPRICE_PER_SCOOP() { - return PRICE_PER_SCOOP; - } - - - public void getIceCream() throws IceCreamFlavorException,IceCreamScoopException { - Scanner nav=new Scanner(System.in); - System.out.print("Enter the ice cream flavor :"); - flavor =nav.nextLine(); - System.out.println("Enter the no. of scoops :"); - scoops=nav.nextInt(); - - if(flavor.equalsIgnoreCase("Black Current")) { - throw new IceCreamFlavorException () ; - } - - if(scoops>3) { - throw new IceCreamScoopException (); - } - System.out.println("Enjoy the Strawberry ice cream "+getFlavor() +" Please pay Rs "+25*scoops); - - } -} - diff --git a/Q_AND_ANS/src/in/exam/ice/package-info.java b/Q_AND_ANS/src/in/exam/ice/package-info.java deleted file mode 100644 index cbcff10..0000000 --- a/Q_AND_ANS/src/in/exam/ice/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -package in.exam.ice; \ No newline at end of file diff --git a/Q_AND_ANS/src/in/exam/service/Administrator.java b/Q_AND_ANS/src/in/exam/service/Administrator.java deleted file mode 100644 index b124e67..0000000 --- a/Q_AND_ANS/src/in/exam/service/Administrator.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - */ -package in.exam.service; -import java.util.*; -import in.exam.ice.*; -import in.exam.util.IceCreamFlavorException; -import in.exam.util.IceCreamScoopException; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class Administrator { - - public static void main(String[] args) { - - IceCream c1=new IceCream(); - try { - c1.getIceCream(); - } catch (IceCreamFlavorException e) { - - System.out.println(e); - } catch (IceCreamScoopException e) { - System.out.println(e); - } - - } - -} - diff --git a/Q_AND_ANS/src/in/exam/service/package-info.java b/Q_AND_ANS/src/in/exam/service/package-info.java deleted file mode 100644 index 900d05e..0000000 --- a/Q_AND_ANS/src/in/exam/service/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -package in.exam.service; \ No newline at end of file diff --git a/Q_AND_ANS/src/in/exam/util/IceCreamFlavorException.java b/Q_AND_ANS/src/in/exam/util/IceCreamFlavorException.java deleted file mode 100644 index e5506f7..0000000 --- a/Q_AND_ANS/src/in/exam/util/IceCreamFlavorException.java +++ /dev/null @@ -1,19 +0,0 @@ -/** - * - */ -package in.exam.util; - -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class IceCreamFlavorException extends Exception { - - public String toString() - { - return "INVALID ICE CREAM FLAVOR"; - } - -} - diff --git a/Q_AND_ANS/src/in/exam/util/IceCreamScoopException.java b/Q_AND_ANS/src/in/exam/util/IceCreamScoopException.java deleted file mode 100644 index b4edf6d..0000000 --- a/Q_AND_ANS/src/in/exam/util/IceCreamScoopException.java +++ /dev/null @@ -1,18 +0,0 @@ -/** - * - */ -package in.exam.util; - -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class IceCreamScoopException extends Exception{ - - public String toString() - { - return "ONLY 3 SCOOPS ARE ALLOWED"; - } -} - diff --git a/Q_AND_ANS/src/in/exam/util/package-info.java b/Q_AND_ANS/src/in/exam/util/package-info.java deleted file mode 100644 index 707b8a5..0000000 --- a/Q_AND_ANS/src/in/exam/util/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -package in.exam.util; \ No newline at end of file diff --git a/Q_AND_ANS/src/newFrame.java b/Q_AND_ANS/src/newFrame.java deleted file mode 100644 index 8ec6f4b..0000000 --- a/Q_AND_ANS/src/newFrame.java +++ /dev/null @@ -1,34 +0,0 @@ -import java.awt.EventQueue; - -import javax.swing.JFrame; -import javax.swing.JLabel; -import java.awt.Font; - -/** - * - */ - -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -import java.awt.EventQueue; -import javax.swing.JFrame; -public class newFrame extends JFrame{ - public newFrame() - { - setBounds(0, 0, 600, 600); - getContentPane().setLayout(null); - - JLabel main = new JLabel("Main Application"); - main.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 30)); - main.setBounds(128, 241, 295, 57); - getContentPane().add(main); - - - - setVisible(true); - } -} - diff --git a/README.md b/README.md index daf822b..54a241d 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,10 @@ -# JavaWorkSpaceHUB -My Daily Java Works -
+# PLAIN SPRING BOOT HEAP IS AROUND = 21 to 25 mb -![Build Status](https://www.code-inspector.com/project/15431/score/svg) -![Build Status](https://www.code-inspector.com/project/15431/status/svg) +- Ten million row (10,000,000) Table Size - *1569 MB* +- Used 7,548,047,136 B 7.5 GB +- -Xlog:gc* log of GC - -

-JAVA IMG -

- - -# THREAD NOTES - 1) [Potential concurrency issue when Integer object is used as a lock in synchronized block](https://gist.github.com/engineerscodes/312780a6c710a9d7ba0a87b074c2c9f0) - 2) [Primitive Wrapper Classes are Immutable in Java](https://www.geeksforgeeks.org/primitive-wrapper-classes-are-immutable-in-java/) - 3) [context switch in synchronized method and block](https://gist.github.com/engineerscodes/d6c06a86a84ee4c78db9f153ceb691af) +IMP : https://spring.io/blog/2015/12/10/spring-boot-memory-performance +---------------------------------------------------------------------------- +# MORE +# Query Plan Cache : https://thorben-janssen.com/hibernate-query-plan-cache/ diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 034e848..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,21 +0,0 @@ -# Security Policy - -## Supported Versions - -Use this section to tell people about which versions of your project are -currently being supported with security updates. - -| Version | Supported | -| ------- | ------------------ | -| 5.1.x | :white_check_mark: | -| 5.0.x | :x: | -| 4.0.x | :white_check_mark: | -| < 4.0 | :x: | - -## Reporting a Vulnerability - -Use this section to tell people how to report a vulnerability. - -Tell them where to go, how often they can expect to get an update on a -reported vulnerability, what to expect if the vulnerability is accepted or -declined, etc. diff --git a/Serialization Interface/.classpath b/Serialization Interface/.classpath deleted file mode 100644 index 4f2c72b..0000000 --- a/Serialization Interface/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/Serialization Interface/.project b/Serialization Interface/.project deleted file mode 100644 index 44a36c4..0000000 --- a/Serialization Interface/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - Serialization Interface - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/Serialization Interface/Output.md b/Serialization Interface/Output.md deleted file mode 100644 index 96e98e0..0000000 Binary files a/Serialization Interface/Output.md and /dev/null differ diff --git a/Serialization Interface/Output.ser b/Serialization Interface/Output.ser deleted file mode 100644 index 699c04a..0000000 Binary files a/Serialization Interface/Output.ser and /dev/null differ diff --git a/Serialization Interface/Output.txt b/Serialization Interface/Output.txt deleted file mode 100644 index 96e98e0..0000000 Binary files a/Serialization Interface/Output.txt and /dev/null differ diff --git a/Serialization Interface/src/Employee.java b/Serialization Interface/src/Employee.java deleted file mode 100644 index 653d56a..0000000 --- a/Serialization Interface/src/Employee.java +++ /dev/null @@ -1,29 +0,0 @@ -import java.io.Serializable; - -/** - * - */ - -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class Employee implements Serializable{ - public String name; - public String last; - public int num; - public Employee() { - name=""; - last=""; - num=0; - } - public Employee(String name,String last,int num) - { - this.name=name; - this.last=last; - this.num=num; - } - -} - diff --git a/Serialization Interface/src/GUIDEMO.java b/Serialization Interface/src/GUIDEMO.java deleted file mode 100644 index 283c1c7..0000000 --- a/Serialization Interface/src/GUIDEMO.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * - */ -import java.awt.Color; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.FileOutputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.*; -import javax.swing.ButtonGroup; -import javax.swing.DefaultListModel; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JRadioButton; - -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class GUIDEMO implements ActionListener,Serializable -{ - JFrame frame; - int count=0; - static JComboBox cb; - JLabel label; - JRadioButton male,female; - ButtonGroup gender; - JButton btn; - public GUIDEMO() - { - frame=new JFrame("main frame"); - cb =new JComboBox(); - btn=new JButton(); - add(); - } - - private void add() - { - frame.setBounds(0,0,500,500); - frame.setLayout(null); - - frame.setBackground(Color.CYAN); //must use .getContentPane() - frame.getContentPane().setBackground(Color.CYAN); - label=new JLabel("name"); - label.setBounds(250,250,150,50); - label.setText("ComboBox "); - frame.add(label); - cb.addItem("TN"); - cb.addItem("ap"); - cb.setBounds(50,50,100,100); - cb.setBackground(Color.green); - - frame.add(cb); - male=new JRadioButton("male",true); - male.setText("MALE"); - male.setBackground(Color.red); - male.setBounds(150,330,120,50); - female=new JRadioButton("Female"); - - female.setText("Female"); - female.setBounds(300,100,150,100); - female.addActionListener(this); - frame.add(male); - frame.add(female); - gender =new ButtonGroup(); - gender.add(male); - gender.add(female); - DefaultListModel dlist=new DefaultListModel(); - dlist.addElement("Java"); - dlist.addElement("c++"); - JListlist=new JList<>(dlist); - list.setBounds(50,150,200,130); - frame.add(list); - list.setBackground(Color.ORANGE); - btn.setText("Click"); - btn.setBounds(350,400,100, 50); - frame.add(btn); - - btn.addActionListener(this); - //list.add("java"); error - try { - FileOutputStream f=new FileOutputStream("Output.ser"); - ObjectOutputStream obj=new ObjectOutputStream(f); - obj.writeObject(frame); - obj.flush(); - obj.close(); - } - catch(Exception e) { - e.printStackTrace(); - } - frame.setVisible(true); - } - - - public static void main(String[] args) - { - new GUIDEMO (); - } - public void actionPerformed(ActionEvent e) - { - - if(count%2==0) - female.setBackground(Color.RED); - else - female.setBackground(Color.yellow); - count++; - try { - FileOutputStream f=new FileOutputStream("Output.ser"); - ObjectOutputStream obj=new ObjectOutputStream(f); - obj.writeObject(frame); - //obj.writeObject(btn); - obj.flush(); - obj.close(); - } - catch(Exception e1) { - e1.printStackTrace(); - } - - } -} - diff --git a/Serialization Interface/src/Read.java b/Serialization Interface/src/Read.java deleted file mode 100644 index 655d7af..0000000 --- a/Serialization Interface/src/Read.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * - */ -import java.util.*; -import java.io.Serializable; -import java.io.FileNotFoundException; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class Read { - - public static void main(String[] args) - { ObjectInputStream obj; - ArrayList n1 = null; - try { - obj=new ObjectInputStream(new FileInputStream("output.ser")); - n1=(ArrayList)obj.readObject(); - } - catch(Exception e) - { - e.printStackTrace(); - } - Employee e[]=new Employee[3]; - for(int i=0;i<3;i++) - e[i]=(Employee)n1.get(i); - for(int i=0;i - - - - - diff --git a/Sorting/.project b/Sorting/.project deleted file mode 100644 index ef52f4c..0000000 --- a/Sorting/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - Sorting - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/Sorting/src/Selection_Sort/BubbleSortGeneric.java b/Sorting/src/Selection_Sort/BubbleSortGeneric.java deleted file mode 100644 index 601ac43..0000000 --- a/Sorting/src/Selection_Sort/BubbleSortGeneric.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * - */ -package Selection_Sort; - -/** - * @author M.NAVEEN - * RANDOM CODER'S - * Tech/Project Lead Android Club - */ -public class BubbleSortGeneric> { - public static void main(String[] args) - { - // example using Strings - String[] arrayOfStrings = {"Andree", "Leana", "Faviola", "Loyce", "Quincy", "Milo", "Jamila", "Toccara", "Nelda", "Blair", "Ernestine", "Chara", "Kareen", "Monty", "Rene", "Cami", "Winifred", "Tara", "Demetrice", "Azucena"}; - BubbleSortGeneric stringSorter = new BubbleSortGeneric<>(); - stringSorter.bubbleSort(arrayOfStrings); - System.out.println(java.util.Arrays.toString(arrayOfStrings)); - - // example using Doubles - Double[] arrayOfDoubles = {0.35, 0.02, 0.36, 0.82, 0.27, 0.49, 0.41, 0.17, 0.30, 0.89, 0.37, 0.66, 0.82, 0.17, 0.20, 0.96, 0.18, 0.25, 0.37, 0.52}; - BubbleSortGeneric doubleSorter = new BubbleSortGeneric<>(); - doubleSorter.bubbleSort(arrayOfDoubles); - System.out.println(java.util.Arrays.toString(arrayOfDoubles)); - } - - void bubbleSort(T[] array) - { - int n = array.length; - while (n > 0) - { - int lastModifiedIndex = 0; - for (int currentIndex = 1; currentIndex < n; currentIndex++) - { - // if the item at the previous index is greater than the item at the `currentIndex`, swap them - if (((Comparable) array[currentIndex - 1]).compareTo(array[currentIndex]) > 0) - { - // swap - T temp = array[currentIndex - 1]; - array[currentIndex - 1] = array[currentIndex]; - array[currentIndex] = temp; - // save the index that was modified - lastModifiedIndex = currentIndex; - } - } - // save the last modified index so we know not to iterate past it since all proceeding values are sorted - n = lastModifiedIndex; - } - } -} \ No newline at end of file diff --git a/Sorting/src/Selection_Sort/Bubble_Sort.java b/Sorting/src/Selection_Sort/Bubble_Sort.java deleted file mode 100644 index f934410..0000000 --- a/Sorting/src/Selection_Sort/Bubble_Sort.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - */ -package Selection_Sort; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class Bubble_Sort -{ - static Scanner nav=new Scanner(System.in); - public static void main(String[] args) - { int size=nav.nextInt(); - int array[]=new int[size]; - //Input - for(int i=0;i=array[j+1]) - { - int c=array[j]; - array[j]=array[j+1]; - array[j+1]=c; - } - } - } - System.out.println("Sorted Array :"+Arrays.toString(array)); - } - -} diff --git a/Sorting/src/Selection_Sort/package-info.java b/Sorting/src/Selection_Sort/package-info.java deleted file mode 100644 index 2bca123..0000000 --- a/Sorting/src/Selection_Sort/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -package Selection_Sort; \ No newline at end of file diff --git a/Sorting/src/Selection_Sort/selection.java b/Sorting/src/Selection_Sort/selection.java deleted file mode 100644 index 2db1c36..0000000 --- a/Sorting/src/Selection_Sort/selection.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * - */ -package Selection_Sort; -import java.util.*; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class selection -{ static Scanner nav=new Scanner(System.in);; - static int array[]; - public selection(int size) - { - array= new int[size]; - - } - - public static void main(String[] args) - { - new selection(nav.nextInt()); - //input - for(int i=0;i - - 4.0.0 - - org.example - SpringBatch - 1.0-SNAPSHOT - - - 21 - 21 - 1.5.5.Final - - - - org.springframework.boot - spring-boot-starter-parent - 3.5.4 - - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-batch - - - - org.projectlombok - lombok - provided - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - - org.mapstruct - mapstruct - ${org.mapstruct.version} - - - - org.postgresql - postgresql - runtime - - - - - org.springframework.boot - spring-boot-starter-actuator - - - - jakarta.validation - jakarta.validation-api - - - - org.springframework.boot - spring-boot-starter-validation - - - - org.springframework.cloud - spring-cloud-starter-circuitbreaker-reactor-resilience4j - 3.3.0 - - - - io.github.resilience4j - resilience4j-bulkhead - 2.2.0 - - - - org.springframework.boot - spring-boot-starter-webflux - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - ${java.version} - ${java.version} - ${project.build.sourceEncoding} - - - org.projectlombok - lombok - ${lombok.version} - - - org.mapstruct - mapstruct-processor - ${org.mapstruct.version} - - - - - - - - - \ No newline at end of file diff --git a/SpringBatch/src/main/java/org/example/Application.java b/SpringBatch/src/main/java/org/example/Application.java deleted file mode 100644 index c8c47d9..0000000 --- a/SpringBatch/src/main/java/org/example/Application.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.example; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - -} diff --git a/SpringBatch/src/main/java/org/example/Config/BatchConfig.java b/SpringBatch/src/main/java/org/example/Config/BatchConfig.java deleted file mode 100644 index 39a5af4..0000000 --- a/SpringBatch/src/main/java/org/example/Config/BatchConfig.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.example.Config; - -import io.github.resilience4j.bulkhead.BulkheadConfig; -import io.github.resilience4j.bulkhead.ThreadPoolBulkheadConfig; -import io.github.resilience4j.bulkhead.annotation.Bulkhead; -import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig; -import io.github.resilience4j.timelimiter.TimeLimiterConfig; -import org.example.component.TimeoutListener; -import org.springframework.batch.core.*; -import org.springframework.batch.core.configuration.annotation.*; -import org.springframework.batch.core.job.builder.*; -import org.springframework.batch.core.launch.JobLauncher; -import org.springframework.batch.core.launch.support.*; -import org.springframework.batch.core.repository.JobRepository; -import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean; -import org.springframework.batch.core.step.builder.*; -import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.cloud.circuitbreaker.resilience4j.ReactiveResilience4jBulkheadProvider; -import org.springframework.cloud.circuitbreaker.resilience4j.Resilience4JCircuitBreakerFactory; -import org.springframework.cloud.circuitbreaker.resilience4j.Resilience4JConfigBuilder; -import org.springframework.cloud.circuitbreaker.resilience4j.Resilience4jBulkheadProvider; -import org.springframework.cloud.client.circuitbreaker.Customizer; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.annotation.EnableTransactionManagement; -import javax.sql.DataSource; -import java.time.Duration; - -@Configuration -@EnableBatchProcessing -@EnableTransactionManagement -public class BatchConfig { - - @Bean - public Job demoJob(JobRepository jobRepository, Step demoStep) { - return new JobBuilder("demoJob", jobRepository) - .listener(new TimeoutListener()) - .start(demoStep) - .build(); - } - - @Bean - public Step demoStep(JobRepository jobRepository, PlatformTransactionManager transactionManager) { - return new StepBuilder("demoStep", jobRepository) - .tasklet((contribution, chunkContext) -> { - for(int i=0; i<5000; i++) { - System.out.println("Processing step " + (i + 1) + "/5"); - Thread.sleep(1000); // Simulate work - } - System.out.println(">>> Running batch job with REST trigger <<<"); - return RepeatStatus.FINISHED; - }, transactionManager).allowStartIfComplete(true) - .build(); - } - - @Bean - public JobRepository jobRepository(DataSource dataSource, PlatformTransactionManager transactionManager) throws Exception { - JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean(); - factory.setDataSource(dataSource); - factory.setTransactionManager(transactionManager); - factory.afterPropertiesSet(); - return factory.getObject(); - } - - @Bean - public JobLauncher jobLauncher(JobRepository jobRepository) throws Exception { - TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher(); - jobLauncher.setJobRepository(jobRepository); - - ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - executor.setCorePoolSize(2); - executor.setMaxPoolSize(2); - executor.setQueueCapacity(2); - executor.setThreadNamePrefix("batch-job-"); - executor.initialize(); - - jobLauncher.setTaskExecutor(executor); - jobLauncher.afterPropertiesSet(); - return jobLauncher; - } - - @Bean - public Customizer defaultCustomizer() { - return factory -> factory.configureDefault(id -> new Resilience4JConfigBuilder(id) - .timeLimiterConfig(TimeLimiterConfig.custom().timeoutDuration(Duration.ofSeconds(4)).build()) - .circuitBreakerConfig(CircuitBreakerConfig.ofDefaults()) - .build()); - } - - @Bean - public Customizer reactiveSpecificBulkheadCustomizer() { - return provider -> provider.configure(builder -> { - builder.bulkheadConfig(BulkheadConfig.custom() - .maxConcurrentCalls(2) - .build()); - }, "serviceBulkhead"); - } - - - -} diff --git a/SpringBatch/src/main/java/org/example/component/TimeoutListener.java b/SpringBatch/src/main/java/org/example/component/TimeoutListener.java deleted file mode 100644 index 60d152d..0000000 --- a/SpringBatch/src/main/java/org/example/component/TimeoutListener.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.example.component; - -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.JobExecutionListener; -import org.springframework.stereotype.Component; - -@Component -public class TimeoutListener implements JobExecutionListener { - - @Override - public void beforeJob(JobExecution jobExecution) { - System.out.println("Job is starting..."); - } - - @Override - public void afterJob(JobExecution jobExecution) { - System.out.println("Job has ended."); - } -} \ No newline at end of file diff --git a/SpringBatch/src/main/java/org/example/controller/Batch.java b/SpringBatch/src/main/java/org/example/controller/Batch.java deleted file mode 100644 index c9f2360..0000000 --- a/SpringBatch/src/main/java/org/example/controller/Batch.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.example.controller; - - -import lombok.extern.slf4j.Slf4j; -import org.springframework.batch.core.Job; -import org.springframework.batch.core.JobParameters; -import org.springframework.batch.core.JobParametersBuilder; -import org.springframework.batch.core.JobParametersInvalidException; -import org.springframework.batch.core.launch.JobLauncher; -import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; -import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException; -import org.springframework.batch.core.repository.JobRestartException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; - -@Slf4j -@Controller -public class Batch { - - - @Autowired - private JobLauncher jobLauncher; - - - @Autowired - private Job demoJob; - - - - @GetMapping("/batch") - private ResponseEntity signUp() throws JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException { - JobParameters params = new JobParametersBuilder() - .addLocalDateTime("date", java.time.LocalDateTime.now()) - .toJobParameters(); - jobLauncher.run(demoJob, params); - log.info("==============================="); - return ResponseEntity.ok("Hello World"); - } - - -} diff --git a/SpringBatch/src/main/java/org/example/service/ExternalReactiveService.java b/SpringBatch/src/main/java/org/example/service/ExternalReactiveService.java deleted file mode 100644 index 6d695ae..0000000 --- a/SpringBatch/src/main/java/org/example/service/ExternalReactiveService.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.example.service; - -import org.springframework.web.reactive.function.client.WebClient; -import io.github.resilience4j.bulkhead.annotation.Bulkhead; -import org.springframework.stereotype.Service; -import reactor.core.publisher.Mono; - -@Service -public class ExternalReactiveService { - @Bulkhead(name = "serviceBulkhead", type = Bulkhead.Type.THREADPOOL) - public Mono fetchData() { - return WebClient.create().get().uri("https://example.com").retrieve().bodyToMono(String.class); - } -} \ No newline at end of file diff --git a/SpringBatch/src/main/resources/application.properties b/SpringBatch/src/main/resources/application.properties deleted file mode 100644 index 1ae0bf4..0000000 --- a/SpringBatch/src/main/resources/application.properties +++ /dev/null @@ -1,16 +0,0 @@ -## Spring JPA -spring.datasource.url=jdbc:postgresql://localhost:5432/postgres -spring.datasource.username=postgres -spring.datasource.password=naveen -spring.jpa.hibernate.ddl-auto=none -spring.jpa.show-sql=true -spring.jpa.properties.hibernate.format_sql=false -hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect -spring.servlet.multipart.enabled=true -spring.servlet.multipart.max-file-size=50MB -spring.servlet.multipart.max-request-size=60MB -spring.output.ansi.enabled=ALWAYS -management.endpoint.metrics.enabled=true -management.endpoints.prometheus.enabled=true -management.endpoints.web.exposure.include=* -spring.batch.jdbc.initialize-schema=never diff --git a/Threads/.classpath b/Threads/.classpath deleted file mode 100644 index fceb480..0000000 --- a/Threads/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/Threads/.project b/Threads/.project deleted file mode 100644 index 35e7365..0000000 --- a/Threads/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - Threads - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/Threads/src/extendsthread/Demo1.java b/Threads/src/extendsthread/Demo1.java deleted file mode 100644 index de91204..0000000 --- a/Threads/src/extendsthread/Demo1.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * if you extend thread plz override run method ,if not it will not throw error - * Thread this a part of Object class under java.util.Object. - */ -package extendsthread; -//import java.lang.Thread; does not need to do this -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class Demo1 extends Thread{ - - public Demo1() - { - - } - - - public static void main(String[] args) - { - Demo1 x=new Demo1(); - System.out.println("Main method"); - x.start(); - x.run(); //prints nothing because the run method is not overridden - - } - -} diff --git a/Threads/src/extendsthread/Demo2.java b/Threads/src/extendsthread/Demo2.java deleted file mode 100644 index fa03bc9..0000000 --- a/Threads/src/extendsthread/Demo2.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - */ -package extendsthread; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class Demo2 extends Thread -{ - - public Demo2() - { - - } - public void run() //overriding the run method - { - System.out.println("Thread is running"); - } - - public static void main(String[] args) - { - new Demo2().start(); //This will can run method - - } - -} diff --git a/Threads/src/extendsthread/demo3.java b/Threads/src/extendsthread/demo3.java deleted file mode 100644 index 5327bf8..0000000 --- a/Threads/src/extendsthread/demo3.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - */ -package extendsthread; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class demo3 extends Thread -{ - - public demo3() - { - - } - public void run() - { - for(int i=1;i<=100;i++) - System.out.println(i); - } - - public static void main(String[] args) - { - new demo3().start(); - new demo3().start(); - - } - -} diff --git a/Threads/src/extendsthread/demo4.java b/Threads/src/extendsthread/demo4.java deleted file mode 100644 index ea411d4..0000000 --- a/Threads/src/extendsthread/demo4.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - */ -package extendsthread; - -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class demo4 extends Thread -{ - - public demo4() - { - - } - - public void run() - { - for(int i=0;i<20;i++) - System.out.println(Thread.currentThread().getName()); - System.out.println(Thread.currentThread().getPriority()); - } - public static void main(String[] args) - { - demo4 t1=new demo4(); t1.setName("Thread 1"); - t1.start(); - demo4 t2=new demo4(); t2.setName("Thread 2"); - t2.start(); - demo4 t3=new demo4(); t3.setName("Thread 3"); - t3.start(); - demo4 t4=new demo4(); t4.setName("Thread 4"); - demo4 t5=new demo4(); t5.setName(" 5th thread"); - for(int i=0;i<20;i++) - System.out.println(Thread.currentThread().getName()); - System.out.println(t5); - } - -} diff --git a/Threads/src/extendsthread/demo6.java b/Threads/src/extendsthread/demo6.java deleted file mode 100644 index 28269a8..0000000 --- a/Threads/src/extendsthread/demo6.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - */ -package extendsthread; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class demo6 extends Thread -{ - - public demo6() - { - - } - public void run() - { - for(int i=1;i<20;i++) - System.out.println(Thread.currentThread().getName()); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - - e.printStackTrace(); - } - } - - public static void main(String[] args) - { - demo6 t1=new demo6(); - t1.start(); t1.setName(" Thread t1"); - demo6 t2=new demo6(); - t2.start(); t2.setName("Thread t2"); - System.out.println("First -"+t1.isAlive()); - System.out.println("second -"+t2.isAlive()); - - try{ - t1.join(); - t2.join(); - } catch (InterruptedException e) { - - e.printStackTrace(); - } - System.out.println("First -"+t1.isAlive()); - System.out.println("second -"+t2.isAlive()); - - - } - -} diff --git a/Threads/src/extendsthread/package-info.java b/Threads/src/extendsthread/package-info.java deleted file mode 100644 index 0b3ad8a..0000000 --- a/Threads/src/extendsthread/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -package extendsthread; \ No newline at end of file diff --git a/Threads/src/implementsthreads/demo1.java b/Threads/src/implementsthreads/demo1.java deleted file mode 100644 index c98aaf5..0000000 --- a/Threads/src/implementsthreads/demo1.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * ImplementS Runnable must Implement run() - */ -package implementsthreads; - -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class demo1 implements Runnable -{ - - public demo1() - { - - } - public void run() - { - System.out.println("Thread is running"); - } - - public static void main(String[] args) - { - Thread t1=new Thread(new demo1()); - t1.start(); - } - -} diff --git a/Threads/src/implementsthreads/demo2.java b/Threads/src/implementsthreads/demo2.java deleted file mode 100644 index 7e58b0e..0000000 --- a/Threads/src/implementsthreads/demo2.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * - */ -package implementsthreads; - -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class demo2 implements Runnable -{ - - public demo2() - { - - } - public void run() - { - for(int i=0;i<10;i++) - System.out.println(Thread.currentThread().getName()); - System.out.println(Thread.currentThread().getPriority()); - } - public static void display() - { - for(int i=0;i<100;i++) - System.out.print(" ,"+i); - } - - public static void main(String[] args) - { - Thread t1=new Thread(new demo2()); - t1.start(); - - display(); - t1.setName("Thread T1"); - Thread t2=new Thread(new demo2()); - t2.start(); - t2.setName("Thread 2"); - } - -} -/* - * Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true - ,0 ,1 ,2Thread-0 -Thread-0 -Thread-0 -Thread-0 -Thread-0 -Thread-0 -Thread-0 -Thread-0 -Thread-0 -Thread-0 - ,35 - ,4 ,5 ,6 ,7 ,8 ,9 ,10 ,11 ,12 ,13 ,14 ,15 ,16 ,17 ,18 ,19 ,20 ,21 ,22 ,23 ,24 ,25 ,26 ,27 ,28 ,29 ,30 ,31 ,32 ,33 ,34 ,35 ,36 ,37 ,38 ,39 ,40 ,41 ,42 ,43 ,44 ,45 ,46 ,47 ,48 ,49 ,50 ,51 ,52 ,53 ,54 ,55 ,56 ,57 ,58 ,59 ,60 ,61 ,62 ,63 ,64 ,65 ,66 ,67 ,68 ,69 ,70 ,71 ,72 ,73 ,74 ,75 ,76 ,77 ,78 ,79 ,80 ,81 ,82 ,83 ,84 ,85 ,86 ,87 ,88 ,89 ,90 ,91 ,92 ,93 ,94 ,95 ,96 ,97 ,98 ,99Thread 2 -Thread 2 -Thread 2 -Thread 2 -Thread 2 -Thread 2 -Thread 2 -Thread 2 -Thread 2 -Thread 2 -5 - * */ diff --git a/Threads/src/implementsthreads/demo3.java b/Threads/src/implementsthreads/demo3.java deleted file mode 100644 index 8fd9f96..0000000 --- a/Threads/src/implementsthreads/demo3.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * - */ -package implementsthreads; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class demo3 implements Runnable -{ - - public demo3() - { - - } - - public void run() - { - for(int i=0;i<20;i++) - { System.out.println(Thread.currentThread().getName()+" -"+i); - //Thread.sleep(100); - /*Exception in thread "Thread t1" java.lang.Error: Unresolved compilation problem: - Unhandled exception type InterruptedException - - at implementsthreads.demo3.run(demo3.java:22) - at java.lang.Thread.run(Unknown Source) - */ - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - public static void display() - { - for(int i=0;i<100;i++) - System.out.print(" ,"+i); - } - public static void main(String[] args) - { - Thread t1=new Thread(new demo3()); - t1.start(); - display(); - t1.setName("Thread t1"); - - } - -} diff --git a/Threads/src/implementsthreads/demo5.java b/Threads/src/implementsthreads/demo5.java deleted file mode 100644 index 06a1c1e..0000000 --- a/Threads/src/implementsthreads/demo5.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - */ -package implementsthreads; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class demo5 implements Runnable -{ - - public demo5() - { - - } - public void run() - { - for(int i=1;i<=100;i++) - System.out.println(Thread.currentThread().getName()); - } - - public static void main(String[] args) - { - demo5 d=new demo5(); - Thread t1=new Thread(d); t1.setName("Thread t1"); - t1.start(); - Thread t2=new Thread(d); t2.setName("Thread t2"); - t2.start(); - t2.suspend(); - Thread t3=new Thread(d); t3.setName("Thread t3"); - t3.start(); - t2.resume(); - Thread t4=new Thread(d); t4.setName("Thread t4"); - t4.start(); - t4.stop(); - t4.resume(); //useless no use it will not print - } - -} diff --git a/Threads/src/implementsthreads/package-info.java b/Threads/src/implementsthreads/package-info.java deleted file mode 100644 index cf4a90d..0000000 --- a/Threads/src/implementsthreads/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -package implementsthreads; \ No newline at end of file diff --git a/Threads/src/priorities/demo1.java b/Threads/src/priorities/demo1.java deleted file mode 100644 index 9d2a7a4..0000000 --- a/Threads/src/priorities/demo1.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - */ -package priorities; -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -public class demo1 extends Thread -{ - - public demo1() - { - - } - public void run() - { - for(int i=0;i<100;i++) - System.out.println(Thread.currentThread().getName()); - System.out.println(Thread.currentThread().getPriority()); - try { - Thread.sleep(100); - } catch (InterruptedException e) - { - e.printStackTrace(); - } - } - public static void main(String[] args) - { - demo1 t1=new demo1(); - t1.setPriority(3); //should use this - t1.start(); - demo1 t2=new demo1(); - t2.setPriority(MAX_PRIORITY-5); - t2.start(); - - } - -} diff --git a/Threads/src/priorities/package-info.java b/Threads/src/priorities/package-info.java deleted file mode 100644 index 6f89db2..0000000 --- a/Threads/src/priorities/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * - */ -/** - * @author M.NAVEEN - RANDOM CODER'S - * - */ -package priorities; \ No newline at end of file diff --git a/com.wipro/.classpath b/com.wipro/.classpath deleted file mode 100644 index fceb480..0000000 --- a/com.wipro/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/com.wipro/.project b/com.wipro/.project deleted file mode 100644 index 41720e5..0000000 --- a/com.wipro/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - com.wipro - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/com.wipro/src/cab/entity/Cab.java b/com.wipro/src/cab/entity/Cab.java deleted file mode 100644 index c0422c6..0000000 --- a/com.wipro/src/cab/entity/Cab.java +++ /dev/null @@ -1,44 +0,0 @@ -package cab.entity; - -public class Cab -{ - int cabId; - String cabType,regNo; - boolean isAvailable; - - public Cab() { - } - public Cab(int cabId, String cabType, String regNo, boolean isAvailable) { - - this.cabId = cabId; - this.cabType = cabType; - this.regNo = regNo; - this.isAvailable = isAvailable; -} - public int getCabId() { - return cabId; - } - public void setCabId(int cabId) { - this.cabId = cabId; - } - public String getCabType() { - return cabType; - } - public void setCabType(String cabType) { - this.cabType = cabType; - } - public String getRegNo() { - return regNo; - } - public void setRegNo(String regNo) { - this.regNo = regNo; - } - public boolean isAvailable() { - return isAvailable; - } - public void setAvailable(boolean isAvailable) { - this.isAvailable = isAvailable; - } - - -} diff --git a/com.wipro/src/cab/entity/CabDepot.java b/com.wipro/src/cab/entity/CabDepot.java deleted file mode 100644 index 02698b9..0000000 --- a/com.wipro/src/cab/entity/CabDepot.java +++ /dev/null @@ -1,82 +0,0 @@ -package cab.entity; - -import java.util.Arrays; - -public class CabDepot -{ - static Cab Cabs[]; - float rentAmount; - Cab bookedCab; - public CabDepot() - { - // TODO Auto-generated constructor stub - } - - public void calculateRent(String cabType, int days) - { - for(int i=0;i=1) - { - return "Valid"; - } - else - { - return "InValid"; - } - - } - else - { - return validateRoute(source,destination); - } - } - public String bookCab(String source, String destination, String cabType, int days) - { Cab n=new Cab(); - String r=validateData(source,destination,cabType,days); - if(r.equalsIgnoreCase("Valid")) - { - cap.calculateRent(cabType,days); - - - if(cap.getRentAmount()==0.0) - { - return "Car Not Available" ; - } - if(cap.getRentAmount()!=0.0) - { - String str=cap.getBookedCabDetails()+"Amount:Rs."+cap.getRentAmount(); - System.out.println(str); - } - } - return ""; - } -} diff --git a/easyq/.classpath b/easyq/.classpath deleted file mode 100644 index fceb480..0000000 --- a/easyq/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/easyq/.project b/easyq/.project deleted file mode 100644 index 4bb9f5b..0000000 --- a/easyq/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - easyq - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/easyq/src/easyq/Move_all_zeroes_to_end.java b/easyq/src/easyq/Move_all_zeroes_to_end.java deleted file mode 100644 index 4886fa9..0000000 --- a/easyq/src/easyq/Move_all_zeroes_to_end.java +++ /dev/null @@ -1,50 +0,0 @@ -package easyq; -/* BY-M.NAVEEN - * engineerscodes - * code -Program for array rotation - * sr.code-Ar2 - * moves zeros to end of the array - * */ -import java.util.*; -public class Move_all_zeroes_to_end // class name -{ static Scanner nav=new Scanner(System.in); // calling Scanner and creating object nav - static int array[],t[],size; // class instances variables - public Move_all_zeroes_to_end(int c) // constructor - { - size=c; - array=new int[size]; //intialization of variables - t=new int[size]; - } - - public static void move() //method to move zero - { int j=0; - for(int i=0;i\nexit"); - switch(nav.nextInt()) - { - case 1:lrotation(); - break; - case 2: rrotation(); - break; - case 3: System.exit(0); - } - - } - - -} -} diff --git a/easyq/src/easyq/Rearrange_1.java b/easyq/src/easyq/Rearrange_1.java deleted file mode 100644 index ee01c86..0000000 --- a/easyq/src/easyq/Rearrange_1.java +++ /dev/null @@ -1,53 +0,0 @@ -package easyq; -/* BY-M.NAVEEN - * engineerscodes - * code -Program for array rotation - * sr.code-Ar2 - * moves zeros to end of the array - * */ -import java.util.*; -public class Rearrange_1 // class name -{ static Scanner nav=new Scanner (System.in); // calling Scanner and creating object nav - static int array[],size,replace=0; // class instances variables - public Rearrange_1(int c) // constructor - { - size=c; - array=new int[size]; //intialization of variables - } - public static void repair() //method - { - for( int i=0;i >"); - for(int i=0;i=0;i--) - { - array[i+1]=array[i]; - } - array[0]=temp; - System.out.println("after rotation element in array are::"+Arrays.toString(array)); - sum(); - } - public static void sum() //Find maximum value of Sum( i*arr[i]) with only rotations on given - { count++; - sum=0; //sum must be initizated to zero - for(int i=0;i=0;i--) - { - array[i+1]=array[i]; - } - array[0]=temp; - System.out.println("after rotation element in array are::"+Arrays.toString(array)); - sum(); - } - public static void sum() //Find value of each rotation Sum( i*arr[i]) with only rotations on given - { count++; - sum=0; //sum must be initizated to zero - for(int i=0;i - - - - - diff --git a/linkedlistss/.project b/linkedlistss/.project deleted file mode 100644 index 5823353..0000000 --- a/linkedlistss/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - linkedlistss - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/linkedlistss/src/linkedlistss/dellist.java b/linkedlistss/src/linkedlistss/dellist.java deleted file mode 100644 index c5f9c78..0000000 --- a/linkedlistss/src/linkedlistss/dellist.java +++ /dev/null @@ -1,32 +0,0 @@ -package linkedlistss; -import java.util.*; -public class dellist -{ static Scanner nav=new Scanner(System.in); - static LinkedList array[]=new LinkedList[5]; - public dellist() - { - for(int i=0;i<5;i++) - { - array[i]=new LinkedList (); - } - } - public static void main(String arg[]) - { dellist n=new dellist(); - for(int i=0;i<5;i++) - { - System.out.println("enter the data -"); - array[i].add(nav.nextInt()); - } - System.out.println("Displaying the linked list "); - for(int i=0;i<5;i++) - { - System.out.print(array[i]+" , "); - } - System.out.println(); - array[1].add(100); - for(int i=0;i<5;i++) - { - System.out.print(array[i]+" , "); - } - } -} diff --git a/linkedlistss/src/linkedlistss/doublelinked.java b/linkedlistss/src/linkedlistss/doublelinked.java deleted file mode 100644 index 4c2b356..0000000 --- a/linkedlistss/src/linkedlistss/doublelinked.java +++ /dev/null @@ -1,201 +0,0 @@ -package linkedlistss; -/* Author-M.NAVEEN - * engineerscodes - * code -DoubllyLinkedList - * sr.code-LL1 - * */ -import java .util.*; -public class doublelinked //class name -{ static Scanner nav=new Scanner(System.in); // calling Scanner and creating object nav - static node head; //object of node class - - public doublelinked() // constructor of class doublelinked - { - head=null; //intialize head=null - } - public static class node //second class node - { - node next,prev; // objects - int data; - node(int data) //constructor of node - { - next=prev=null; //intialization of next and prev =null - this.data=data; //this() function refer to global - } - } - public static void insertbegin(int new_data) //method to insert at the begining of the list - { - node new_node=new node(new_data); //creating new node - if(head==null) //check if list is null - { - head=new_node; //directly assign head=new_node - return; - } - new_node.next=head; //assign newnodes--> next to head - head.prev=new_node; //assign prev<--heads=new_node - head=new_node; //assign head=new_node - - } - public static void insertend(int new_data)//method to insert at the end of the list - { - node new_node=new node(new_data); //creating new node - if(head==null) //check if list is null - { - head=new_node; //directly assign head=new_node - return; - - } - node last=head; //creating temp object of class node and assign head to last - while(last.next!=null) //traversing the list using next till you reach the end - last=last.next; //traversing the list by assigning last=last--next---> - last.next=new_node; //assign last-->next=newnode - new_node.prev=last; //assign prev<--newnode=last - } - public static void insertpos(node temp,int new_data) //method to insert after position - { - if(head.next==null) //check is head.next=null or only one node is present - { - return; //then return - } - node new_node =new node(new_data); //create a new node - if(temp.next==null) //if list size is less than position - { System.out.println("Not possible because list size is less than position so,newnode will be appened"); - insertend(new_data); //if list size is less than position then add insert at end - return; - } - new_node.next=temp.next; - new_node.prev=temp; - temp.next.prev=new_node; - temp.next=new_node; - - } - public static void display()//method to print display - { - if(head==null) //check head is null or not - { - System.out.println("List is empty"); - return; - } - node first=head; // if head is not null - while(first!=null) - { - System.out.print(first.data+" , "); - first=first.next; - } - System.out.println("\n list in reverse-order ");//println reverse of the list using prev - node last=head; - while(last.next!=null) - last= last.next; - - while(last.prev!=null) //traversing using prev from end to begining of the list - { - System.out.print(last.data+" , "); - last=last.prev; - } - if(last.prev==null) //println the first element of the list - { - System.out.print(last.data+" , "); - return; - } - } - public static void removefront() //deletion from front of the list - { - if(head==null) // if list is empty then return - { - System.out.println("List is empty"); - return; - } - if(head.next==null) //if only one element is present - { - System.out.println("The element is deleted :"+head.data); - head=null; - return; - } - System.out.println("The element is deleted :"+head.data); - head=head.next;//moving the head to delete the front element - head.prev=null; - } - public static void removeend() //deletion from end - { - if(head==null) //if list is empty - { System.out.println("List is empty"); - return; - } - if(head.next==null) // if only one element exist - { - System.out.println("The element is deleted :"+head.data); - head=null; - return; - } - node last=head; //temp node to traverse till end of the list - while(last.next.next!=null) - { - - last=last.next; - } - System.out.println("the element delted is-"+last.next.data); - last.next.prev=null; // assigning last--next--prev-->null breaking the link - last.next=null; - - - } - public static void main(String arg[]) //main method - { - System.out.println("Implementation of Doublly linkedlist "); - while(true) - { - System.out.println("\n1)Insert in Begining \n2)Insert at end \n3)Display \n4)EXIT \n5)remove from front \n6)remove from end \n7)Insert After position"); - switch(nav.nextInt()) - { - case 1:System.out.println("Enter the data ->"); - insertbegin(nav.nextInt()); - break; - case 2:System.out.println("Enter the data ->"); - insertend(nav.nextInt()); - break; - case 4:System.exit(0); - break; - - case 3:System.out.println("Displaying the list"); - display(); - break; - case 5:removefront(); - break; - case 6:removeend(); - break; - case 7:System.out.println("Enter the position -"); - int pos=nav.nextInt(); - if(pos==0) - { System.out.println("enter the data ->"); - insertbegin(nav.nextInt()); - } - else - { node temp=head; - if(head==null) - { - System.out.println("Not possible list is empty"); - System.out.println("enter the data"); - insertbegin(nav.nextInt()); - - } - else if(temp.next==null) - { System.out.println("enter the data"); - insertend(nav.nextInt()); - - } - else{ - for(int i=1;i2-->3-->4 - * list2=0-->1-->9-->2 - * output=1,2 - * sr.code-LL8 - * */ -import java.util.*; - -import linkedlistss.linkedswap.node; -public class intersectionlist //class name -{ static Scanner nav=new Scanner (System.in); // calling Scanner and creating object nav - static node headx,heady,head; - public intersectionlist() //constructor of class intersectionlist - { - headx=heady=null; //intersectionlist - head=null; - } - public static class node //second class node - { - node next; - int data; - node (int data) // constructor of class node - { - next=null; //initialization of next to null - this.data=data; //initialization of instances variable of class node using this() - } - } - public static void addx(int new_data) //insert at begin in 1st list - { - node new_node=new node (new_data); - new_node.next=headx; - headx=new_node; - } - public static void addy(int new_data) //insert at begin in 2rd list - { - node new_node=new node (new_data); - new_node.next=heady; - heady=new_node; - } - - public static void instersection() //method to find common elements in list - { - node x=headx; //temp node x,y are used for traversing and finding common nodes - node y =heady; - System.out.println(" list --->>>>"); - while(x!=null) - { - node tempy=y; //traverse the second list and till first list is null - while(tempy!=null) - { - if(x.data==tempy.data) //if first--node is equal to second node - { - tempy=new node(x.data); //creating new node - tempy.next=head; //tempy.mext=head; for first element head=null and head keeps a track of intersection List; - head=tempy; //head= tempy - } - tempy=tempy.next; - } - x=x.next; - } - } - - public static void display() //display mathod - { System.out.println(" list ---"); - node last=head; - while(last!=null) - { - System.out.print(last.data+" , "); - last=last.next; - } - - } - - - public static void main(String[] args) //main method - { intersectionlist n=new intersectionlist(); - /*This program is only for sorting a linkedlist - * So,I have directly given values in add fuction u can edit this my caliing add function and adding values at runtime - * For futhure information plz check r singllyLinkeList program and DoubllyLinkedlist code in Git - * - * */ - addx(10); - addx(5); - addx(30); - addx(40); - addx(50); - addx(60); - addx(13); - addy(1); - addy(3); - addy(5); - addy(40); - addy(55); - addy(60); - addy(45); - addy(1200); - addy(13); - instersection(); - display(); - - } -} diff --git a/linkedlistss/src/linkedlistss/linked.java b/linkedlistss/src/linkedlistss/linked.java deleted file mode 100644 index 7b25592..0000000 --- a/linkedlistss/src/linkedlistss/linked.java +++ /dev/null @@ -1,278 +0,0 @@ -package linkedlistss; -/* Author-M.NAVEEN - * engineerscodes - * code --single_LinkedList - * sr.code-LL2 - * */ -import java.util.*; -public class linked //class name -{ static Scanner nav=new Scanner(System.in); // calling Scanner and creating object nav - static node head; //object of node class - - public linked() // constructor of class linked - { - head=null; //intialize head=null - } - public static class node //second class node - { - node next; - int data; - node(int d) // constructor of class node - { - next=null; //intialization of next =null - data=d; - } - } - - public static void insertbegin(int new_data ) //method to insert at the begining of the list - { node new_node= new node( new_data); //creating new node - new_node.next=head; //assign newnodes--> next to head - head=new_node; //then assign to new__node - } - - public static void insertend(int new_data) //method to insert at the end of the list - { - node new_node =new node(new_data); //creating new node - node temp=head; //temp node(object of class node) to traverse till end of the list - if(head==null) //if list is empty - { - head=new_node; //since list is empty head.next will not exist so directly assign head=newnode - return; - } - new_node.next=null; //when len(list)<1 - while(temp.next!=null) - { - temp=temp.next; //traverse till end using temp=temp--next---> - } - temp.next=new_node;//after reaching the end assign temp.next=new_node which was previous(temp--next-->)= null - } - public static void insertafterpos(node temp,int new_data) ///method to insert after position - { node new_node=new node(new_data); //create a new node - if(head==null) //check is head.next=null or only one node is present - { head=new_node; - return; - } - if(temp.next==null)//if position >len of list - { - insertend(new_data); - return; - } - new_node.next=temp.next; - temp.next=new_node; - } - public static void display() //method to print linkedlist - { - node dis=head; - if(head==null) //if list is empty - {System.out.println("Linkedlist is empty"); - return; - } - while(dis!=null) //traversing through list to print node.data - {System.out.print(dis.data+" , "); - dis=dis.next;} - } - public static void removefront() //deletion from front of the list - { - if(head==null) // if list is empty then return - { - System.out.println("List is empyt"); - return; - } - if(head.next==null) //if only one element is present - - { - System.out.println("the element in list is deleted -"+head.data); - head=null; - return; - } - System.out.println("the element in list is deleted -"+head.data); - head=head.next; //moving head to delete the front element - } - - public static void removeend() //deletion from end - { - if(head==null) //if list is empty - { System.out.println("List is empyt"); - return; - } - if(head.next==null) // if only one element exist - { - System.out.println("the element in list is deleted -"+head.data); - head=null; - return; - } - node last=head; //temp node to traverse till second last node of the list - while(last.next.next!=null) - { - last=last.next; - } - System.out.println("The element in list is deleted -"+last.next.data); - last.next=null; // assigning last--next-->null breaking the link - } - public static void removepos(int pos) //deleteion using key - { - if(pos==1) //if pos is 1 - { - removefront(); //directly remove front - return; - } - if(head==null)//if list is empty - { System.out.println("List is empty"); - return; - } - node del=head; - for(int i=2;i>>>"); - display(); - - } - -} diff --git a/linkedlistss/src/linkedlistss/looplidt.java b/linkedlistss/src/linkedlistss/looplidt.java deleted file mode 100644 index f44e2f8..0000000 --- a/linkedlistss/src/linkedlistss/looplidt.java +++ /dev/null @@ -1,54 +0,0 @@ -package linkedlistss; -import java.util.*; - -public class looplidt -{ static Scanner nav=new Scanner (System.in); - static int qu[],top; - static node head; - - public looplidt() - { qu=new int[10]; - - head=null; - } -public static class node -{ - node next; - int data; - public node(int data) - { - this.data=data; - next=null; - } -} -public static void add(int new_data) -{ - node new_node= new node(new_data); - if(head==null) - { - head=new_node; - return; - } - -} -public static void countloop() -{ - int cnt=0; - node last=head; - for(int i=0;i<4;i++) - { - qu[i]=last.data; - last=last.next; - } -} -public static void main(String naveen[]) -{ - System.out.println("Looped linkedlist "); - add(1); - node last=head; - last.next=new node(2); - last.next.next=new node(3); - last.next.next.next=new node(4); - last.next.next.next.next=last; -} -} diff --git a/linkedlistss/src/linkedlistss/merge.java b/linkedlistss/src/linkedlistss/merge.java deleted file mode 100644 index 408723b..0000000 --- a/linkedlistss/src/linkedlistss/merge.java +++ /dev/null @@ -1,9 +0,0 @@ -package linkedlistss; - -public class merge { - - public merge() { - // TODO Auto-generated constructor stub - } - -} diff --git a/linkedlistss/src/linkedlistss/nodefromend.java b/linkedlistss/src/linkedlistss/nodefromend.java deleted file mode 100644 index b7d95f6..0000000 --- a/linkedlistss/src/linkedlistss/nodefromend.java +++ /dev/null @@ -1,91 +0,0 @@ -package linkedlistss; -/* Author-M.NAVEEN - * engineerscodes - * code --single_LinkedList ..get node from front - * pos=is one - * list=80,50,10 - * output=80 - * sr.code-LL9 - * */ -import java.util.Scanner; - -import linkedlistss.linked.node; - - -public class nodefromend //class name -{ - - static Scanner nav=new Scanner(System.in); // calling Scanner and creating object nav - static node head; - public nodefromend () //constructor of class intersectionlist - { - head=null; //initialization of class variable - } - public static class node //second class node - { - node next; - int data; - node(int data) // constructor of class node - { - this.data=data; //initialization of instances variable of class node using this() - next=null; //initialization of next to null - } - } - - public static void add(int new_data) //insert at the begining of the list - { node new_node=new node( new_data); - if(head==null) - { - head=new_node; - return; - } - new_node.next=head; - head=new_node; - } - public static int getnode(int pos) //method to get node using position from begining - { int cnt=1; - if(head==null) - { - System.out.println("The list is empty"); - return -1; - } - node temp=head; - while(temp!=null) //count total size of list - { - temp=temp.next; - cnt++; - } - node last=head; - if(cnt2-->3-->4 - * list2=0-->1-->9-->2 - * output=3,4,0,9 - * sr.code-LL9 - * */ -import java.util.*; - -import linkedlistss.intersectionlist.node; -public class noninter //class name -{ - static Scanner nav=new Scanner (System.in); // calling Scanner and creating object nav - static node headx,heady,head; - public noninter() //constructor of noninter - { - headx=head=heady=null; //initialization - - } - public static class node //second class node - { - node next; - int data; - node(int data) // constructor of class node - { - this.data=data; //initialization of instances variable of class node using this() - next=null; //initialization of next to null - } - } - public static void addx(int new_data) //insert at begin in 1st list - { - node new_node=new node (new_data); - new_node.next=headx; - headx=new_node; - } - public static void addy(int new_data) //insert at begin in 2rd list - { - node new_node=new node (new_data); - new_node.next=heady; - heady=new_node; - } - public static void noninter() //method to find uncommon elements in list - { - node x=headx; //temp node x,y are used for traversing and finding uncommon nodes - node y =heady; - System.out.println(" list --->>>>"); - while(x!=null) - { System.out.println("x="+x.data); - node tempy=y; //traverse the second list and till first list is null - while(tempy!=null) - { System.out.println(" y="+tempy.data); - if(x.data!=tempy.data) - { System.out.println(" y="+tempy.data); - tempy=new node(x.data); - tempy.next=head; - head=tempy; - } - tempy=tempy.next; - } - x=x.next; - } - } - public static void display() - { System.out.println(" list ---"); - node last=head; - while(last!=null) - { - System.out.print(last.data+" , "); - last=last.next; - } - - } - - - public static void main(String[] args) - { intersectionlist n=new intersectionlist(); - addx(10); - addx(5); - addx(30); - addx(40); - addx(50); - addx(60); - addx(13); - - addy(5); - addy(40); - addy(55); - addy(60); - addy(45); - addy(1200); - addy(13); - noninter(); - display(); - - } - -} diff --git a/linkedlistss/src/linkedlistss/pairwiselist.java b/linkedlistss/src/linkedlistss/pairwiselist.java deleted file mode 100644 index e3bb6ce..0000000 --- a/linkedlistss/src/linkedlistss/pairwiselist.java +++ /dev/null @@ -1,84 +0,0 @@ -package linkedlistss; -/* Author-M.NAVEEN - * engineerscodes - * code --single_LinkedList pairwise swap - * list=1-->2-->3-->4 - * swappedlist=2-->1-->4-->2 - * - * sr.code-LL7 - * */ -import java.util.*; - -public class pairwiselist //class name -{ static Scanner nav=new Scanner (System.in); // calling Scanner and creating object nav - static node head; - public pairwiselist() //constructor of class pairwiselist - { - head=null; //initialization head=null - } - - public static class node //second class node - { - node next; - int data; - node(int data) // constructor of class node - { - this.data=data; //initialization of instances variable of class node using this() - next=null; //initialization of next to null - } - } - - public static void add(int new_data) //insert at the begining - { - node new_node =new node(new_data); - new_node.next=head; - head=new_node; - } - public static void pairswap() //method pairwise swap - { - if(head==null) - { - System.out.println("Not possible"); - return; - } - node last=head; - while(last!=null && last.next!=null ) - { - int d=last.data; - last.data=last.next.data; - last.next.data=d; - last=last.next.next; - } - } - public static void display() //displaying the list - { System.out.println("displaying list ---"); - node dis=head; - if(head==null) - { - System.out.println("not possible list is empty"); - } - while(dis!=null) - { - System.out.print(dis.data+" , "); - dis=dis.next; - } - } - - public static void main(String naveen[]) - { pairwiselist n=new pairwiselist(); - System.out.println("entering elements in list"); - add(10); - add(20); - add(30); - add(40); - add(50); - add(60); - add(55); - System.out.println(" list ---"); - display(); - pairswap(); - System.out.println(" list --->>>>"); - display(); - - } -} diff --git a/linkedlistss/src/linkedlistss/panlindromelist.java b/linkedlistss/src/linkedlistss/panlindromelist.java deleted file mode 100644 index 14628fb..0000000 --- a/linkedlistss/src/linkedlistss/panlindromelist.java +++ /dev/null @@ -1,85 +0,0 @@ -package linkedlistss; -/* Author-M.NAVEEN - * engineerscodes - * code --single_LinkedList to check is panlindrome or not - * list=1-->2-->3-->3-->2-->1 - * This panlindrome - * sr.code-LL6 - * */ -import java.util.*; -public class panlindromelist //class name -{ static Scanner nav=new Scanner(System.in); // calling Scanner and creating object nav - static node head; //object of node class - public panlindromelist() // constructor of class panlindromelist - { - head=null; //initialization head=null - } - - public static class node //second class node - { - node next; - int data; - node(int data) // constructor of class node - { this.data=data; //initialization of instances variable of class node using this() - next=null; //initialization of next to null - - } - } - - public static void add(int new_data) //method to insert in list - { node new_node=new node(new_data); - if(head==null) - { head=new_node; - return; - } - new_node.next=head; - head=new_node; - - } - public static void checkp() //method to check is list is panlindrome - { int i=0,flag=1; - int a[]; - node last=head; - while(last!=null) - { - last=last.next; - i++; - } - a=new int[i]; //temp array to store values of list and cjeck if it's a panlindrome - int j=0; - node last1=head; - while(last1!=null) - { a[j++]=last1.data; //assign the value to the array - last1=last1.next; - } - System.out.println(Arrays.toString(a)); - for(int c=0,k=i-1;c2-->3-->4-->5-->6 - * odd_list=1-->3-->5 - * even_list=2-->4-->6 - * sr.code-LL5 - * */ -import java.util.*; -public class segregate_list //class name -{ static Scanner nav=new Scanner(System.in); // calling Scanner and creating object nav - static node head,evenh,oldh; //object of node class - public segregate_list() // constructor of class segregate - { - head=evenh=oldh=null; //initialization head&evenh&oldh=null - } - public static class node //second class node - { - node next; - int data; - node(int data) // constructor of class node - { - this.data=data; //initialization of instances variable of class node using this() - next=null; //initialization of next to null - } - - } - public static void add(int new_data) //insert at begin - { - node new_node=new node(new_data); - new_node.next=head; - head=new_node; - - } - public static void sep() //method to seperate odd or even - { - if(head==null) - { - System.out.println("List is empty "); - return; - } - node dis=head; - while(dis!=null) - { - if((dis.data)%2==0) // node.data==even the then data is passed to even head - { - node temp=new node(dis.data); - temp.next=evenh; - evenh=temp; - } - else - { - node temp=new node(dis.data); // node.data==even the then data is passed to odd head - temp.next=oldh; - oldh=temp; - } - dis=dis.next; - } - } - - public static void display() //method to display linkedlist - { - if(evenh==null) - { System.out.println("even list is empty"); - return; - } - if(oldh==null) - { System.out.println("odd list is empty"); - return; - } - System.out.println("even list"); - node c=evenh; - while(c!=null) - { - System.out.print(c.data+" ,"); - c=c.next; - } - System.out.println("\n odd list"); - c=oldh; - while(c!=null) - { - System.out.print(c.data+" ,"); - c=c.next; - } - } - -public static void main(String arg[]) //main method -{ - segregate_list n=new segregate_list(); //calling constructor of the class segregate_list - /*This program is only for sorting a linkedlist - * So,I have directly given values in add fuction u can edit this my caliing add function and adding values at runtime - * For futhure information plz check r singllyLinkeList program and DoubllyLinkedlist code in Git - * - * */ - add(10); - add(11); - add(44); - add(5); - add(0); - add(1999); - add(1); - sep(); - display(); -} -} diff --git a/linkedlistss/src/linkedlistss/slistswap.java b/linkedlistss/src/linkedlistss/slistswap.java deleted file mode 100644 index 42c53f1..0000000 --- a/linkedlistss/src/linkedlistss/slistswap.java +++ /dev/null @@ -1,128 +0,0 @@ -package linkedlistss; -/* Author-M.NAVEEN - * engineerscodes - * code --single_LinkedList_Swapping without swapping data - * by swapping node ex->a--b--c---d---e - * after swapping(b,d) ex-> a--d--c--b--e - * sr.code-LL4 - * */ -import java.util.*; - -import linkedlistss.linkedswap.node; -public class slistswap //class name -{ static Scanner nav=new Scanner(System.in); // calling Scanner and creating object nav - static node head,prevX,currX,prevY,currY; //object of node class - - public slistswap() // constructor of class slistswap - { head=null; //initialization head=null - } - public static class node //second class node - { - node next; // constructor of class node - int data; - node (int data) - { - this.data=data; //initialization of instances variable of class node using this() - next=null; //initialization of next to null - } - } - public static void add(int new_data) //insert at begin - { - node new_node = new node(new_data); - new_node.next=head; - head=new_node; - } - public static void getX(int x) //A method to find the first element to swap - { - if(head==null) - { - System.out.println(" list is empty"); - return; - } - prevX=null; - currX=head; - while(currX!=null && currX.data!=x) //A method to find the first elements prevXnode and that node to swap - { prevX=currX; - currX=currX.next; - } - } - public static void getY(int y) //A method to find the Second element to swap - { if(head==null) - { - System.out.println(" list is empty"); - return; - } - prevY=null; - currY=head; - while(currY!=null && currY.data!=y) //A method to Second the first elements prevYnode and that node to swap - { - prevY=currY; - currY=currY.next; - } - - } - -public static void swap(int x,int y) //method to swap -{ getX(x); - getY(y); - if(x==y) //if both are same element - { - System.out.println(" Swap is not possible"); - return; - } - if(currX==null || currY==null ) - { - System.out.println("not possible elemts does not exist"); - return; - } - if(prevX!=null) //if X is not null - prevX.next=currY; - else - head=currY; //if x is null - - if(prevY!=null) //if y is not null - prevY.next=currX; - else - head=currX; //if y is null - - node temp=currX.next; //temp to store currX--next-->address - currX.next=currY.next;//assign y's next to it - currY.next=temp;//then y's--next-->=temp; - System.out.println("List after swapping x and y"); - display(); -} -public static void display() //method to display -{ if(head==null) - { System.out.print(" list is empty "); - return; - } - node last=head; - while(last!=null) - { - System.out.print(last.data+" , "); - last=last.next; - } -} -public static void main(String naveen[]) //main method -{ slistswap n=new slistswap();//craeting object(n) of the class sort_a_list to call constructor - System.out.println("enter the list =="); - /*This program is only for sorting a linkedlist - * So,I have directly given values in add fuction u can edit this my caliing add function and adding values at runtime - * For futhure information plz check r singllyLinkeList program and DoubllyLinkedlist code in Git - * - * */ - add(100); - add(10); - add(20); - add(30); - add(40); - add(50); - add(60); - System.out.println("Display the linkedlist"); - display(); - System.out.println("enter the x and Y to swap"); - swap(nav.nextInt(),nav.nextInt()); - - -} -} diff --git a/linkedlistss/src/linkedlistss/sort_a_list.java b/linkedlistss/src/linkedlistss/sort_a_list.java deleted file mode 100644 index fc91193..0000000 --- a/linkedlistss/src/linkedlistss/sort_a_list.java +++ /dev/null @@ -1,104 +0,0 @@ -package linkedlistss; -/* Author-M.NAVEEN - * engineerscodes - * code --single_LinkedList sorting - * sr.code-LL3 - * */ -import java.util.*; -public class sort_a_list //class name -{ static Scanner nav=new Scanner(System.in); // calling Scanner and creating object nav - static node head; //object of node class - static int sort[]; //array to sort - public sort_a_list() // constructor of class sort_a_list - { - head=null; //initialization head=null - } - public static class node //second class node - { - node next; - int data; - node(int data) // constructor of class node - { - next=null; //initialization of next =null - this.data=data; //initialization of instances variable of class node using this() - } - } -public static void add(int new_data) //insert at begining of the list -{ node new_node =new node(new_data); - if(head==null) - { - head=new_node; - return; - } - new_node.next=head; - head=new_node; -} -public static void count() //to count the size of the list -{ int count=0; - node last=head; - while(last!=null) - { - last=last.next; - count++; - } - sort(count); //calling sort function after calculating size -} -public static void sort(int size) //method sort to sort linkedlist -{ sort=new int[size]; - int count=0; - node last=head; - while(last!=null) - { sort[count]=last.data; //assign all values of list in array - last=last.next; - count++; - } - Arrays.sort(sort);//calling java sort method to sort array you can use our own method to sort also bubblesort and ect - System.out.println(" sort"); - System.out.print(Arrays.toString(sort)); //printing sorted array - head=null; //deleting the complete list - for(int i=sort.length-1;i>=0;i--)//inserting to the list in sorted order - { - add(sort[i]); - } - //u can use this method also (below one) - /* node temp=head; - head=temp; - for(int i=sort.length-1;i>=0;i--) - { - temp.data=sort[i]; - System.out.println(temp.data+" , "); - temp=temp.next; - - }*/ - display(); -} -public static void display() -{ node last =head; - System.out.println(" sorted list -- "); - while(last!=null) - { - System.out.print(last.data+" , "); - last=last.next; - } - -} -public static void main(String args[]) //main method -{ sort_a_list n=new sort_a_list(); //craeting object of the class sort_a_list to call constructor - - System.out.print("likedlist"); - /*This program is only for sorting a linkedlist - * So,I have directly given values in add fuction u can edit this my caliing add function and adding values at runtime - * For futhure information plz check r singllyLinkeList program and DoubllyLinkedlist code in Git - * - * */ - add(100); - add(50); - add(70); - add(52); - add(60); - add(1); - add(12); - add(55); - count(); -} -} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..c5ffd1c --- /dev/null +++ b/pom.xml @@ -0,0 +1,71 @@ + + + 4.0.0 + + org.engineerscodes.app + DryTest + 1.0-SNAPSHOT + + + 21 + 21 + UTF-8 + + + org.springframework.boot + spring-boot-starter-parent + 3.3.2 + + + + + + org.springframework.boot + spring-boot-starter-web + 3.3.2 + + + + org.springframework.boot + spring-boot-starter-data-jpa + 3.3.2 + + + + org.postgresql + postgresql + 42.7.3 + + + + org.projectlombok + lombok + 1.18.32 + compile + + + + org.springframework.boot + spring-boot-starter-webflux + + + + org.springframework.boot + spring-boot-starter-data-r2dbc + + + jakarta.persistence + jakarta.persistence-api + + + + org.postgresql + r2dbc-postgresql + 1.0.5.RELEASE + + + + + \ No newline at end of file diff --git a/src/main/java/org/engineerscodes/app/Bike.java b/src/main/java/org/engineerscodes/app/Bike.java new file mode 100644 index 0000000..e804757 --- /dev/null +++ b/src/main/java/org/engineerscodes/app/Bike.java @@ -0,0 +1,17 @@ +package org.engineerscodes.app; + +public final class Bike implements DataLake, allowed { + + @Override + public void sendMsg(allowed obj) { + + } +} + +final class D { + + /* public void sendMsg(allowed obj) { + new Bike().sendMsg(new D()); + } + */ +} \ No newline at end of file diff --git a/src/main/java/org/engineerscodes/app/Car.java b/src/main/java/org/engineerscodes/app/Car.java new file mode 100644 index 0000000..e236998 --- /dev/null +++ b/src/main/java/org/engineerscodes/app/Car.java @@ -0,0 +1,14 @@ +package org.engineerscodes.app; + +public final class Car implements DataLake, allowed { + + @Override + public void sendMsg(allowed obj) { + if(obj instanceof Car car){ + //ToDO + } + else{ + //TODO + } + } +} diff --git a/src/main/java/org/engineerscodes/app/Controller.java b/src/main/java/org/engineerscodes/app/Controller.java new file mode 100644 index 0000000..8218302 --- /dev/null +++ b/src/main/java/org/engineerscodes/app/Controller.java @@ -0,0 +1,30 @@ +package org.engineerscodes.app; + +import lombok.extern.slf4j.Slf4j; +import org.engineerscodes.app.jpa.millions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Flux; +import reactor.core.scheduler.Scheduler; +import reactor.core.scheduler.Schedulers; + +@RestController +@RequestMapping("DryTest") +@Slf4j +public class Controller { + + @Autowired + MillionsService millionsService; + + @GetMapping(produces = MediaType.TEXT_EVENT_STREAM_VALUE) + public Flux get(){ + log.info("START"); + return millionsService.processStreaming().take(1_000_000).publishOn(Schedulers.parallel()) + .onBackpressureBuffer() + .doOnComplete(()->log.info("OVER")); + } + +} diff --git a/src/main/java/org/engineerscodes/app/DataLake.java b/src/main/java/org/engineerscodes/app/DataLake.java new file mode 100644 index 0000000..11f1c39 --- /dev/null +++ b/src/main/java/org/engineerscodes/app/DataLake.java @@ -0,0 +1,10 @@ +package org.engineerscodes.app; + +sealed interface allowed permits Car,Bike{ } + +public interface DataLake { + + + void sendMsg(allowed obj); + +} \ No newline at end of file diff --git a/src/main/java/org/engineerscodes/app/DbConfig.java b/src/main/java/org/engineerscodes/app/DbConfig.java new file mode 100644 index 0000000..bbb030a --- /dev/null +++ b/src/main/java/org/engineerscodes/app/DbConfig.java @@ -0,0 +1,64 @@ +package org.engineerscodes.app; + +import java.util.HashMap; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import jakarta.persistence.EntityManagerFactory; + +@Configuration +@EnableJpaRepositories( + entityManagerFactoryRef = "db1EntityManagerFactory", + transactionManagerRef = "db1TransactionManager", + basePackages = { "org.engineerscodes.app.jpa" }) +@EnableTransactionManagement +public class DbConfig { + + + @Primary + @Bean(name = "dataSource1") + DataSource dataSource() { + return DataSourceBuilder.create() + .url("jdbc:postgresql://localhost:5432/BigData") + .username("postgres") + .password("naveen") + .build(); + } + + @Primary + @Bean(name = "db1EntityManagerFactory") + LocalContainerEntityManagerFactoryBean db1EntityManagerFactory(final EntityManagerFactoryBuilder builder, + @Qualifier("dataSource1") DataSource dataSource) { + + final HashMap properties = new HashMap<>(); + properties.put("hibernate.hbm2ddl.auto", "update"); + properties.put("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect"); + + return builder.dataSource(dataSource) + .properties(properties) + .packages("org.engineerscodes.app.jpa") + .build(); + } + + @Primary + @Bean(name = "db1TransactionManager") + PlatformTransactionManager db1TransactionManager(@Qualifier("db1EntityManagerFactory") final EntityManagerFactory entityManagerFactory) { + return new JpaTransactionManager(entityManagerFactory); + } + +} + diff --git a/src/main/java/org/engineerscodes/app/Main.java b/src/main/java/org/engineerscodes/app/Main.java new file mode 100644 index 0000000..5f888b8 --- /dev/null +++ b/src/main/java/org/engineerscodes/app/Main.java @@ -0,0 +1,38 @@ +package org.engineerscodes.app; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; +import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.data.r2dbc.config.EnableR2dbcAuditing; +import org.springframework.data.r2dbc.repository.config.EnableR2dbcRepositories; + + +@SpringBootApplication +@Slf4j +@EnableR2dbcAuditing +public class Main { + + @Autowired + private MillionsService millionsService; + + + public static void main(String[] args) { + SpringApplication.run(Main.class); + } + + @Bean + public CommandLineRunner initializer() { + return args -> { + log.info("START : {} ,MAX {}",Runtime.getRuntime().freeMemory(),Runtime.getRuntime().maxMemory()); + //millionsService.processStreaming(); + log.info("END"); + }; + } +} \ No newline at end of file diff --git a/src/main/java/org/engineerscodes/app/MillionsService.java b/src/main/java/org/engineerscodes/app/MillionsService.java new file mode 100644 index 0000000..dc1f138 --- /dev/null +++ b/src/main/java/org/engineerscodes/app/MillionsService.java @@ -0,0 +1,33 @@ +package org.engineerscodes.app; + +import lombok.extern.slf4j.Slf4j; +import org.engineerscodes.app.jpa.Repo; +import org.engineerscodes.app.jpa.millions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.data.domain.Sort; +import org.springframework.data.r2dbc.core.R2dbcEntityOperations; +import org.springframework.data.relational.core.query.Criteria; +import org.springframework.data.relational.core.query.Query; +import org.springframework.stereotype.Service; +import reactor.core.publisher.Flux; + +@Service +@Slf4j +public class MillionsService { + + @Autowired + private Repo repo; + + @Autowired + @Qualifier("db2EntityManagerFactory") + R2dbcEntityOperations R2dbcEntityOperations; + + + public Flux processStreaming() { + //List millionsList = repo.findAll(); + //millionsList.parallelStream().forEach(System.out::println); + return R2dbcEntityOperations.select(millions.class).matching(Query.query(Criteria.empty()) + .sort(Sort.by("id").ascending()).limit(1_000_000)).all(); + } +} diff --git a/src/main/java/org/engineerscodes/app/R2dbcConfig.java b/src/main/java/org/engineerscodes/app/R2dbcConfig.java new file mode 100644 index 0000000..ba6d34f --- /dev/null +++ b/src/main/java/org/engineerscodes/app/R2dbcConfig.java @@ -0,0 +1,48 @@ +package org.engineerscodes.app; + +import io.r2dbc.spi.ConnectionFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.r2dbc.core.R2dbcEntityOperations; +import org.springframework.data.r2dbc.core.R2dbcEntityTemplate; +import org.springframework.data.r2dbc.dialect.PostgresDialect; +import org.springframework.data.r2dbc.repository.config.EnableR2dbcRepositories; +import org.springframework.r2dbc.connection.R2dbcTransactionManager; +import org.springframework.r2dbc.core.DatabaseClient; +import io.r2dbc.postgresql.PostgresqlConnectionFactory; +import io.r2dbc.postgresql.PostgresqlConnectionConfiguration; +import org.springframework.transaction.ReactiveTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + + +@Configuration +@EnableTransactionManagement +@EnableR2dbcRepositories(basePackages = "org.engineerscodes.app.r2dc", + entityOperationsRef = "db2EntityManagerFactory") +@EntityScan(basePackages = "org.engineerscodes.app.r2dc") +public class R2dbcConfig { + + @Bean + @Qualifier("postgresql") + public ConnectionFactory postgresqlConnectionFactory() { + return new PostgresqlConnectionFactory( + PostgresqlConnectionConfiguration.builder() + .host("localhost") + .port(5432) + .username("postgres") + .password("naveen") + .database("BigData") + .build() + ); + } + + @Bean(name = "db2EntityManagerFactory") + public R2dbcEntityOperations postgresqlR2dbcEntityOperations(@Qualifier("postgresql") ConnectionFactory connectionFactory) { + + DatabaseClient databaseClient = DatabaseClient.create(connectionFactory); + + return new R2dbcEntityTemplate(databaseClient, PostgresDialect.INSTANCE); + } +} \ No newline at end of file diff --git a/src/main/java/org/engineerscodes/app/jpa/Repo.java b/src/main/java/org/engineerscodes/app/jpa/Repo.java new file mode 100644 index 0000000..a18e8d1 --- /dev/null +++ b/src/main/java/org/engineerscodes/app/jpa/Repo.java @@ -0,0 +1,14 @@ +package org.engineerscodes.app.jpa; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +import java.util.stream.Stream; + +@Repository +public interface Repo extends JpaRepository { + + @Query("select m from millions m") + Stream findAllByStreaming(); +} diff --git a/src/main/java/org/engineerscodes/app/jpa/millions.java b/src/main/java/org/engineerscodes/app/jpa/millions.java new file mode 100644 index 0000000..d35b8b5 --- /dev/null +++ b/src/main/java/org/engineerscodes/app/jpa/millions.java @@ -0,0 +1,27 @@ +package org.engineerscodes.app.jpa; + + +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Entity +@Table +@Data +@NoArgsConstructor +public class millions { + + @Id + Long id; + + String name; + + String location; + + String cat; + + Integer value; + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..6e0b699 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,21 @@ +## Spring JPA +spring.db1.datasource.url=jdbc:postgresql://localhost:5432/BigData +spring.db1.datasource.username=postgres +spring.db1.datasource.password=naveen +spring.jpa.hibernate.ddl-auto=update +spring.jpa.show-sql=true +spring.jpa.properties.hibernate.format_sql=true +spring.threads.virtual.enabled=true +#hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect +hibernate.generate_statistics=true +#spring.jpa.properties.hibernate.jdbc.batch_size=30 +#spring.jpa.properties.hibernate.default_batch_fetch_size=20 +logging.level.org.springframework.r2dbc=DEBUG +#spring.datasource-secondary.url=r2dbc:postgresql://localhost:5432/BigData +#spring.datasource-secondary.username=postgres +#spring.datasource-secondary.password=naveen +#spring.datasource-secondary.driverClassName=org.postgresql.Driver +server.connection-timeout=30m +spring.webflux.timeout.connect=30m +spring.webflux.timeout.response=30m +spring.mvc.async.request-timeout=3000000000