Snippets Collections
import java.util.*;

class LinearProb {
    int csize, maxsize;
    String keys[];
    String vals[];

    LinearProb(int capacity) {
        csize = 0;
        maxsize = capacity;
        keys = new String[maxsize];
        vals = new String[maxsize];
    }

    public int hash(String key) {
        return Math.abs(key.hashCode()) % maxsize; // Corrected hash function
    }

    public void insert(String key, String val) {
        int index = hash(key);
        while (keys[index] != null && !keys[index].equals(key)) {
            index = (index + 1) % maxsize; // Linear probing
        }
        keys[index] = key;
        vals[index] = val;
        csize++;
    }

    public void print() {
        System.out.println("Hash Table");
        for (int i = 0; i < maxsize; i++) {
            if (keys[i] != null) {
                System.out.println(keys[i] + " " + vals[i]);
            }
        }
    }
}

public class Main {
    public static void main(String args[]) {
        Scanner s = new Scanner(System.in);
        System.out.println("Enter size");
        int capacity = s.nextInt();
        LinearProb lp = new LinearProb(capacity);
        for (int i = 0; i < capacity; i++) {
            System.out.println("Enter key and val");
            lp.insert(s.next(), s.next());
        }
        lp.print();
    }
}


import java.util.*;

interface Value{
	public Double pi();
}
public class LambdaPI{
	public static void main(String args[]){
		Value pi = ()-> {
			return 3.14;
		};
		System.out.print("PI value: "+pi.pi());
	}
}
interface Capture
{ int compute(int n); }

public class CaptureDemo
{   private int a = 100;
    
	public int getA(){ return this.a; }
	
	public static void main(String[] args)
	{
		CaptureDemo c1 = new CaptureDemo();
		System.out.println("Value: "+c1.getA());
		
		int x = 200;
		Capture ob = (n)-> {
			int z = 12;
			int result = z + n + x + c1.getA();
			c1.a = 9876;
			//x++;
			return result;
		};
		
		System.out.println(ob.compute(40));
		System.out.println("Value: "+c1.getA()); 
	}

}
import java.util.Scanner;

interface Test {
    boolean check(int n);
}

public class LambdaTest {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        
        Test isEven = n -> (n % 2) == 0;
        Test isNonNegative = n -> n >= 0;
        
        System.out.print("Enter a number: ");
        int x = scan.nextInt();
        System.out.println(x + " is even? " + isEven.check(x));

        System.out.print("Enter another number: ");
        x = scan.nextInt();
        System.out.println(x + " is non-negative? " + isNonNegative.check(x));
    }
}
import java.util.*; 
 
public class BinarySearchTree 
{ 
 class Node 
 {  int key; 
  Node left, right; 
   
  public Node(int data) 
  {  key = data; 
   left = right = null; 
  } 
 } 
   
 private Node root; 
  
 public BinarySearchTree() 
 { root=null; } 
 
 public void insert(int data) 
 {  root = insertRec(root, data); } 
  
 private Node insertRec(Node root,int key) 
 {  if (root == null)  
  { root = new Node(key); 
   return root; 
  }   
  if (key < root.key)   
   root.left = insertRec(root.left, key); 
  else if (key > root.key)  
   root.right = insertRec(root.right, key); 
 
  return root; 
 } 
  
 public void inorder() 
 { inorderRec(root); }  
  
 private void inorderRec(Node root) 
 { 
  if (root != null) { 
  inorderRec(root.left); 
  System.out.print(root.key + " "); 
  inorderRec(root.right); 
  } 
 } 
  
  
 
 
 
 
public void preorder() 
 {   preorderrec(root);  } 
  
 private void preorderrec(Node node) 
 { 
  if (node == null) 
   return; 
  System.out.print(node.key + " "); 
  preorderrec(node.left); 
  preorderrec(node.right); 
 } 
  
 public void postorder() 
 {   postorderrec(root); } 
  
 private void postorderrec(Node node) 
 { 
  if (node == null) 
   return; 
  postorderrec(node.left); 
  postorderrec(node.right); 
  System.out.print(node.key + " "); 
 } 
  
 public static void main(String[] args)  
 { 
  Scanner sc = new Scanner(System.in); 
  BinarySearchTree bst = new BinarySearchTree(); 
  String ch=""; 
  do{ 
  System.out.print("Enter the element to be inserted in the tree: "); 
   int n=sc.nextInt(); 
   sc.nextLine(); 
    
   bst.insert(n); 
 System.out.print("Do you want to insert another element? (Say 'yes'): "); 
   ch = sc.nextLine(); 
  }while(ch.equals("yes")); 
   
 System.out.print("Inorder Traversal : The elements in the tree are: "); 
  bst.inorder(); 
  System.out.println();  
 System.out.print("Preorder Traversal : The elements in the tree are: "); 
  bst.preorder(); 
  System.out.println();   
 System.out.print("Postorder Traversal : The elements in the tree are: "); 
  bst.postorder(); 
  System.out.println(); 
 } 
}

OUTPUT:

Enter the element to be inserted in the tree: 50
Do you want to insert another element? (Say 'yes'): yes
Enter the element to be inserted in the tree: 30
Do you want to insert another element? (Say 'yes'): yes
Enter the element to be inserted in the tree: 20
Do you want to insert another element? (Say 'yes'): yes
Enter the element to be inserted in the tree: 40
Do you want to insert another element? (Say 'yes'): yes
Enter the element to be inserted in the tree: 70
Do you want to insert another element? (Say 'yes'): yes
Enter the element to be inserted in the tree: 60
Do you want to insert another element? (Say 'yes'): yes
Enter the element to be inserted in the tree: 80
Do you want to insert another element? (Say 'yes'): no
Inorder Traversal : The elements in the tree are: 20 30 40 50 60 70 80 
Preorder Traversal : The elements in the tree are: 50 30 20 40 70 60 80 
Postorder Traversal : The elements in the tree are: 20 40 30 60 80 70 50
public class LambdaDemo
{
	public static void main(String[] args)
	{
		MyNum num = () -> 123.456;
		System.out.println("This is the value: " + num.getNum());
		
		num = () -> Math.random() * 100;
		System.out.println("This is the random value: " + num.getNum());
		System.out.println("This is one more random value: " + num.getNum());
	}
}
import java.util.*; 
 
public class BinarySearchTree3  
{ 
  class Node { 
    int key; 
    Node left, right; 
 
    public Node(int item) { 
      key = item; 
      left = right = null; 
    } 
  } 
 
  private Node root; 
 
  public BinarySearchTree3()  
  {  
    root = null; 
  } 
 
  public void insert(int key)  
  { root = insertKey(root, key); } 
 
  private Node insertKey(Node root, int key)  
  { if (root == null)  
    { 
      root = new Node(key); 
      return root; 
    } 
 
    if (key < root.key) 
      root.left = insertKey(root.left, key); 
    else if (key > root.key) 
      root.right = insertKey(root.right, key); 
 
    return root; 
  } 
 
  public void inorder() { 
    inorderRec(root); 
  } 
 
  private void inorderRec(Node root) { 
    if (root != null) { 
      inorderRec(root.left); 
      System.out.print(root.key + " "); 
      inorderRec(root.right); 
    } 
  } 
 
 
  public void deleteKey(int key)  
  { root = deleteRec(root, key); } 
 
  private Node deleteRec(Node root, int key)  
  { if (root == null) 
      return root; 
 
    if (key < root.key) 
      root.left = deleteRec(root.left, key); 
    else if (key > root.key) 
      root.right = deleteRec(root.right, key); 
    else  
 { if (root.left == null) 
        return root.right; 
      else if (root.right == null) 
        return root.left; 
    
      root.key = minValue(root.right); 
      root.right = deleteRec(root.right, root.key); 
    } 
    return root; 
  } 
   
  public int minValue(Node root) { 
    int minv = root.key; 
    while (root.left != null) { 
      minv = root.left.key; 
      root = root.left; 
    } 
    return minv; 
  } 
    
  public static void main(String[] args)  
  { 
  Scanner sc = new Scanner(System.in); 
  BinarySearchTree3 bst = new BinarySearchTree3(); 
  String ch=""; 
  do{ 
  System.out.print("Enter the element to be inserted in the tree: "); 
   int n=sc.nextInt(); 
   sc.nextLine(); 
    
   bst.insert(n); 
 System.out.print("Do you want to insert another element? (Say 'yes'): "); 
   ch = sc.nextLine(); 
  }while(ch.equals("yes")); 
  System.out.println(); 
 System.out.print("Inorder Traversal : The elements in the tree are: "); 
  bst.inorder(); 
  System.out.println(); 
System.out.print("Enter the element to be removed from the tree: "); 
int r=sc.nextInt(); 
sc.nextLine(); 
System.out.println(); 
bst.deleteKey(r); 
System.out.print("Inorder traversal after deletion of "+r); 
bst.inorder(); 
System.out.println(); 
} 
}




OUTPUT:

Enter the element to be inserted in the tree: 50
Do you want to insert another element? (Say 'yes'): yes
Enter the element to be inserted in the tree: 30
Do you want to insert another element? (Say 'yes'): yes
Enter the element to be inserted in the tree: 20
Do you want to insert another element? (Say 'yes'): yes
Enter the element to be inserted in the tree: 40
Do you want to insert another element? (Say 'yes'): yes
Enter the element to be inserted in the tree: 70
Do you want to insert another element? (Say 'yes'): yes
Enter the element to be inserted in the tree: 60
Do you want to insert another element? (Say 'yes'): yes
Enter the element to be inserted in the tree: 80
Do you want to insert another element? (Say 'yes'): no

Inorder Traversal : The elements in the tree are: 20 30 40 50 60 70 80 
Enter the element to be removed from the tree: 50

Inorder traversal after deletion of 50: 20 30 40 60 70 80 
##Box.java:

class Box<T> {
    private T value;
    public Box(T value) 
    { 
        this.value = value; 
        
    }
    public T getValue() 
    { 
        return value; 
        
    }
}

class GenericBox<T> extends Box<T> {
    public GenericBox(T value) { super(value); }
    public void display() { System.out.println("Value: " + getValue()); }
}



##InheritanceWithGenerics.java

public class InheritanceWithGenerics {
    public static void main(String[] args) {
        Box<Integer> integerBox = new Box<>(10);
        System.out.println("Integer Value: " + integerBox.getValue());

        GenericBox<String> stringBox = new GenericBox<>("Hello");
        stringBox.display();
    }
}
interface StringFunction
{ String reverse(String s); }

public class BlockLambdaReverse
{
	public static void main(String[] args)
	{
		java.util.Scanner scan = new java.util.Scanner(System.in);
		
		StringFunction sf = (s) -> {
			String r = "";
			for(int i=s.length()-1; i>=0; i--)
				r += s.charAt(i);
			return r;
		};
		System.out.println("Enter an input string: ");
		String s = scan.nextLine();
		System.out.println("The reverse of "+s+" is "+sf.reverse(s));
	}
}
// Disable all automatic updates and update checks
add_filter('automatic_updater_disabled', '__return_true');
add_filter('auto_update_core', '__return_false');
add_filter('pre_site_transient_update_core', '__return_null');
add_filter('pre_site_transient_update_plugins', '__return_null');
add_filter('pre_site_transient_update_themes', '__return_null');

// Disable plugin updates
remove_action('load-update-core.php', 'wp_update_plugins');
add_action('admin_init', function() {
    remove_action('admin_init', '_maybe_update_plugins');
    remove_action('wp_update_plugins', 'wp_update_plugins');
    remove_action('load-plugins.php', 'wp_update_plugins');
});

// Disable theme updates
remove_action('load-update-core.php', 'wp_update_themes');
add_action('admin_init', function() {
    remove_action('admin_init', '_maybe_update_themes');
    remove_action('wp_update_themes', 'wp_update_themes');
    remove_action('load-themes.php', 'wp_update_themes');
});

// Disable update notifications
add_action('admin_init', function() {
    remove_action('admin_notices', 'update_nag', 3);
});
import java.util.Scanner;

public class AVLTree<T extends Comparable<T>> {
    class Node {
        T value;
        Node left, right;
        int height = 0;
        int bf = 0;

        public Node(T ele) {
            this.value = ele;
            this.left = this.right = null;
        }
    }

    private Node root;

    public boolean contains(T ele) {
        if (ele == null) {
            return false;
        }
        return contains(root, ele);
    }
    private boolean contains(Node node, T ele) {
        if(node == null) return false;
        int cmp = ele.compareTo(node.value);
        if (cmp > 0)
            return contains(node.right, ele);
        else if (cmp < 0)
            return contains(node.left, ele);
        return true;
    }

    public boolean insert(T ele) {
        if (ele == null || contains(ele))
            return false;
        root = insert(root, ele);
        return true;
    }
    private Node insert(Node node, T ele) {
        if (node == null)
            return new Node(ele);
        int cmp = ele.compareTo(node.value);
        if (cmp < 0)
            node.left = insert(node.left, ele);
        else
            node.right = insert(node.right, ele);
        update(node);
        return balance(node);
    }

    public boolean delete(T ele) {
        if (ele == null || !contains(ele))
            return false;

        root = delete(root, ele);
        return true;
    }
    private Node delete(Node node, T ele) {
        int cmp = ele.compareTo(node.value);
        if (cmp > 0)
            node.right = delete(node.right, ele);
        else if (cmp < 0)
            node.left = delete(node.left, ele);
        else {
            if (node.right == null)
                return node.left;
            else if (node.left == null)
                return node.right;
            if (node.left.height > node.right.height) {
                T successor = findMax(node.left);
                node.value = successor;
                node.left = delete(node.left, successor);
            } else {
                T successor = findMin(node.right);
                node.value = successor;
                node.right = delete(node.right, successor);
            }
        }
        update(node);
        return balance(node);
    }

    private T findMax(Node node) {
        while (node.right != null) {
            node = node.right;
        }
        return node.value;
    }
    private T findMin(Node node) {
        while (node.left != null) {
            node = node.left;
        }
        return node.value;
    }

    private void update(Node node) {
        int leftSubTreeHeight = (node.left == null) ? -1 : node.left.height;
        int rightSubTreeHeight = (node.right == null) ? -1 : node.right.height;

        node.height = 1 + Math.max(leftSubTreeHeight, rightSubTreeHeight);
        node.bf = leftSubTreeHeight - rightSubTreeHeight;
    }

    private Node balance(Node node) {
        if (node.bf == 2) {
            if (node.left.bf >= 0) {
                return leftLeftRotation(node);
            } else {
                return leftRightRotation(node);
            }
        } else if (node.bf == -2) {
            if (node.right.bf >= 0) {
                return rightLeftRotation(node);
            } else {
                return rightRightRotation(node);
            }
        }
        return node;
    }

    private Node leftLeftRotation(Node node) {
        Node newParent = node.left;
        node.left = newParent.right;
        newParent.right = node;
        update(node);
        update(newParent);
        return newParent;
    }
    private Node rightRightRotation(Node node) {
        Node newParent = node.right;
        node.right = newParent.left;
        newParent.left = node;
        update(node);
        update(newParent);
        return newParent;
    }
    private Node leftRightRotation(Node node) {
        node.left = rightRightRotation(node.left);
        return leftLeftRotation(node);
    }
    private Node rightLeftRotation(Node node) {
        node.right = leftLeftRotation(node.right);
        return rightRightRotation(node);
    }

    public void inorder() {
        if (root == null)
            return;
        inorder(root);
        System.out.println();
    }
    private void inorder(Node node) {
        if(node == null) return;
        inorder(node.left);
        System.out.print(node.value + " ");
        inorder(node.right);
    }
    
    public void preorder() {
        if (root == null)
        return;
        preorder(root);
        System.out.println();
    }
    private void preorder(Node node) {
        if(node == null) return;
        System.out.print(node.value + " ");
        preorder(node.left);
        preorder(node.right);
    }
    
    public void postorder() {
        if (root == null)
        return;
        postorder(root);
        System.out.println();
    }
    private void postorder(Node node) {
        if(node == null) return;
        postorder(node.left);
        postorder(node.right);
        System.out.print(node.value + " ");
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        AVLTree<Integer> avl = new AVLTree<>();
        int ch;
        do {
            System.out.println("1. Insert a value");
            System.out.println("2. Delete a value");
            System.out.println("3. Display");
            System.out.println("4. Exit");
            System.out.print("Enter choice: ");
            ch = sc.nextInt();
            switch (ch) {
                case 1:
                    System.out.print("Enter value: ");
                    int ele = sc.nextInt();
                    if(!avl.insert(ele)) {
                        System.out.println("Invalid input");
                    }
                    break;
                case 2:
                    System.out.print("Enter value: ");
                    if(!avl.delete(sc.nextInt())) {
                        System.out.println("Invalid input");
                    }
                    break;
                case 3:
                    avl.preorder();
                    break;
                case 4:
                    System.exit(0);
                    break;
            
                default:
                    break;
            }
        } while(ch != 4);
        sc.close();
    }
}
if ('serviceWorker' in navigator) {
  var scope = location.pathname.replace(/\/[^\/]+$/, '/')
  navigator.serviceWorker.register('sw.js', { scope })
    .then(function(reg) {
       reg.addEventListener('updatefound', function() {
         var installingWorker = reg.installing;
         console.log('A new service worker is being installed:',
                     installingWorker);
       });
       // registration worked
       console.log('Registration succeeded. Scope is ' + reg.scope);
    }).catch(function(error) {
      // registration failed
      console.log('Registration failed with ' + error);
    });
}
import java.util.*; 
 
public class HashSetDemo 
{ 
 public static void main(String[] args) 
 { 
  HashSet<String> hs = new HashSet<>(); 
   
  hs.add("first"); hs.add("second"); hs.add("third");  
  hs.add("fourth"); hs.add("fifth"); hs.add("sixth"); 
   
  System.out.println("Contents: " + hs); 
  System.out.println("Size: " + hs.size()); 
  System.out.println(); 
   
  Object[] arrayS = hs.toArray(); 
  for(Object each: arrayS) 
   System.out.println(each); 
   
  System.out.println(); 
  String[] arrayS2 = new String[hs.size()]; 
  arrayS2 = hs.toArray(arrayS2); 
  for( String each: arrayS2) 
   System.out.println(each); 
   
  System.out.println(); 
  Iterator it = hs.iterator(); 
  while(it.hasNext()) 
   System.out.println(it.next()); 
   
  System.out.println(); 
  System.out.println("Empty? " + hs.isEmpty()); 
  System.out.println(); 
   
  hs.remove("fourth"); 
  System.out.println("Contents: " + hs); 
  System.out.println("Size: " + hs.size()); 
 } 
} 
interface NumFunction
{ long factorial(int n); }

public class BlockLambdaDemo
{
	public static void main(String[] args)
	{
		NumFunction nf = (n) -> {
			            int result = 1;
						for(int i=2; i<=n; i++)
							result *= i;
						return result;
		};
		
		java.util.Scanner scan = new java.util.Scanner(System.in);
		
		System.out.println("Enter an integer: ");
		int n = scan.nextInt();
		System.out.println("The factorial of " + n + " is " + nf.factorial(n));
		
		System.out.println("Enter an integer: ");
		n = scan.nextInt();
		System.out.println("The factorial of " + n + " is " + nf.factorial(n));
		
	}
}
 
import java.util.*; 
 
public class HashMapDemo 
{ 
 public static void main(String[] args) 
 { 
  HashMap<String, Integer> hm = new HashMap<>(); 
  hm.put("Anand", 20); 
  hm.put("Mary", 20); 
  hm.put("Ravi", 21); 
  hm.put("John",19); 
  System.out.println("Contents: "+hm); 
   
  System.out.println(); 
  Set<String> keys = hm.keySet(); 
  for(String k: keys) 
   System.out.println(k+" -- "+hm.get(k)); 
   
  System.out.println(); 
   
  Set<Map.Entry<String, Integer>> entries = hm.entrySet(); 
  for(Map.Entry<String,Integer> each: entries) 
   System.out.println(each.getKey()+" -- "+each.getValue()); 
   
  System.out.println(); 
 } 
} 
import java.util.*; 
 
public class ArrayListDemo 
{ 
 public static void main(String[] args) 
 { 
  ArrayList<String> al = new ArrayList<>(); 
   
  al.add("one"); al.add("two"); al.add("three"); al.add("four"); 
al.add("five"); 
  System.out.println("Contents: " + al); 
  System.out.println("Size: " + al.size()); 
  System.out.println(); 
   
  for(String s: al) 
   System.out.println(s); 
  System.out.println(); 
   
  for(int i=0; i<al.size(); i++) 
   System.out.println(al.get(i)); 
  System.out.println(); 
   
  Iterator it = al.iterator(); 
  ListIterator lit = al.listIterator(); 
  
  while(it.hasNext()) 
   System.out.println(it.next()); 
  System.out.println(); 
   
  while(lit.hasNext()) 
   System.out.println(lit.next()); 
  System.out.println(); 
   
  while(lit.hasPrevious()) 
   System.out.println(lit.previous()); 
  System.out.println(); 
     
  al.add(0, "zero"); 
  System.out.println("Contents: " + al); 
  System.out.println("Size: " + al.size()); 
   
  al.remove("one"); al.remove(0); 
  System.out.println("Contents: " + al); 
  System.out.println("Size: " + al.size()); 
   
 } 
} 
  
public class Container<T> {
    private T obj;

    public Container(T obj) {
        this.obj = obj;
    }

    public T getObj() {
        return this.obj;
    }

    public void showType() {
        System.out.println("Type is: " + obj.getClass().getName());
    }

    public static void main(String[] args) {
        // Container for a String
        Container<String> c1 = new Container<>("Generics");
        String s = c1.getObj();
        System.out.println("String is: " + s);
        c1.showType();

        // Container for an Integer
        Container<Integer> c2 = new Container<>(123);
        int i = c2.getObj();
        System.out.println("Integer is: " + i);
        c2.showType();
    }
}
interface Args
{ String compute(String s); }

public class ArgsDemo
{
	public void m(Args obj, String s)
	{ System.out.println(obj.compute(s)); 
	 }
	
	public static void main(String[] args)
	{
		ArgsDemo ad = new ArgsDemo();
		
		Args L1 = (str) -> str.toUpperCase();
		ad.m(L1, args[0]);
		
		ad.m((str)->str.toLowerCase(), args[0]);
	}
}
SELECT
AMC_Status__c,Job_Role__c,AMC_Last_Activity_Date__c, Industry_Level_2_Master__c, Industry__c, SubscriberKey, Consent_Level_Summary__c,
Business_Unit__c, Region, Cat_Campaign_Most_Recent__c, Mailing_City__c, Mailing_Country__c, LastModifiedDate, Language__c AS LanguageCode, CreatedDate
 
FROM (
SELECT
DISTINCT i.Region__c AS Region,c.AMC_Status__c,c.Job_Role__c,c.AMC_Last_Activity_Date__c, i.Industry_Level_2_Master__c, i.Industry__c,
c.Id AS SubscriberKey, c.Consent_Level_Summary__c, i.Business_Unit__c,i.Cat_Campaign_Most_Recent__c , i.Mailing_City__c, i.Mailing_Country__c, i.LastModifiedDate, c.Language__c, i.CreatedDate,
 
ROW_NUMBER() OVER(PARTITION BY c.ID ORDER BY i.LastModifiedDate DESC) as RowNum
 
FROM ent.Interaction__c_Salesforce i
JOIN ent.Contact_Salesforce_1 c ON LOWER(c.Email) = LOWER(i.Email__c)
JOIN ep_mr_en_us_w170049_Exclusions_Dealers_Agency_Competitor exc ON LOWER(c.Email) = LEFT JOIN [ep_mr_en_us_w170049_Exclusions_Dealers_Agency_Competitor] e ON LOWER(c.Email) = LOWER(e.EmailAddress)

WHERE
e.EmailAddress IS NULL
AND ((
i.Business_Unit__c LIKE '%Electric Power%' OR
i.Business_Unit__c = 'EP' OR
i.Industry__c LIKE '%Electric Power%' OR
i.Industry_Level_2_Master__c in ('Data Centers', 'Emergency Power', 'Power Plants', 'Power Generation')
)
    AND (Email__c IS NOT NULL OR exc.EmailAddress IS NOT NULL)
    AND ((i.Mailing_Country__c = 'US' AND  c.Consent_Level_Summary__c in ('Express Consent' , 'Validated Consent', 'Legacy Consent')) OR (i.Mailing_Country__c != 'US' AND  c.Consent_Level_Summary__c in ('Express Consent' , 'Validated Consent')))
    AND Email__c NOT LIKE '%@cat.com'
    AND i.Mailing_Country__c IS NOT NULL
    AND c.AMC_Status__c = 'Active'
    AND c.AMC_Last_Activity_Record_ID__c <> 'Not Marketable'
    AND  (i.System_Language__c like 'en_%' OR (i.Mailing_Country__c != 'CA' AND i.System_Language__c is null))
   
        ))t2
 
WHERE RowNum = 1
import java.util.Scanner;
import java.util.function.Function;

public class LambdaStringCase {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter a string: ");
        String input = scanner.nextLine();

        Function<String, String> toUpperCase = str -> str.toUpperCase();

        Function<String, String> toLowerCase = str -> str.toLowerCase();

        String upperCaseString = toUpperCase.apply(input);
        System.out.println("Uppercase: " + upperCaseString);

        String lowerCaseString = toLowerCase.apply(input);
        System.out.println("Lowercase: " + lowerCaseString);
    }
}
import java.util.*; 
 
public class TreeSetDemo 
{    
    class MyComparator implements Comparator<String> 
 { public int compare(String s1, String s2) 
  { if(s1.compareTo(s2)<0)  
   return -1; 
    if(s1.compareTo(s2)>0)  
     return +1; 
    return 0; 
  } 
 } 
 public static void main(String[] args) 
 { 
  TreeSet<String> ts =  
                 new TreeSet<>(new TreeSetDemo().new MyComparator()); 
  ts.add("hello"); ts.add("world"); ts.add("version"); 
  ts.add("main"); ts.add("method"); 
   
  System.out.println("Contents: " + ts); 
  System.out.println(); 
   
  System.out.println("Higher than \"main\": " + ts.higher("main")); 
  System.out.println("Lower than \"main\": " + ts.lower("main")); 
  System.out.println(); 
     
  SortedSet s = ts.tailSet("method"); 
  System.out.println("TailSet from \"method\": " + s); 
  s = ts.headSet("method"); 
  System.out.println("HeadSet from \"method\": " + s); 
  System.out.println(); 
   
  Iterator it = ts.iterator(); 
  System.out.print("Iteration: "); 
  while(it.hasNext()) 
   System.out.print(it.next()+" "); 
   
  System.out.println(); 
  System.out.println(); 
  Iterator it2 = ts.descendingIterator(); 
  System.out.print("Iteration Descending: "); 
  while(it2.hasNext()) 
   System.out.print(it2.next()+" "); 
   
  System.out.println(); 
  System.out.println("First one: " + ts.pollFirst()); 
  System.out.println("Last one: " + ts.pollLast()); 
  System.out.println("Contents: " + ts); 
  } 
}
import java.util.*; 
 
public class TreeMapDemo 
{ 
 public static void main(String[] args) 
 { 
  TreeMap<String, Integer> tm = new TreeMap<>(); 
  tm.put("Anand", 20); 
  tm.put("Mary", 20); 
  tm.put("Ravi", 21); 
  tm.put("John",19); 
  System.out.println("Contents: "+tm); 
   
  System.out.println(); 
  Set<String> keys = tm.keySet(); 
  for(String k: keys) 
   System.out.println(k+" -- "+tm.get(k)); 
   
  System.out.println(); 
   
  Set<Map.Entry<String, Integer>> entries = tm.entrySet(); 
  for(Map.Entry<String,Integer> each: entries) 
   System.out.println(each.getKey()+" -- "+each.getValue()); 
   
  System.out.println(); 
 } 
} 
import java.util.ArrayList;

public class Stack<E extends Number> {
    private ArrayList<E> list;

    public Stack(ArrayList<E> list) {
        this.list = list;
    }

    public void push(E element) {
        list.add(element);
    }

    public E pop() {
        if (list.isEmpty()) {
            throw new IllegalStateException("Stack is empty");
        }
        return list.remove(list.size() - 1);
    }

    public int size() {
        return list.size();
    }

    public double average() {
        if (list.isEmpty()) {
            return 0.0;
        }
        double sum = 0.0;
        for (E element : list) {
            sum += element.doubleValue();
        }
        return sum / list.size();
    }

    public boolean compareAverage(Stack<? extends Number> other) {
        return Double.compare(this.average(), other.average()) == 0;
    }

    public static void main(String[] args) {
        Stack<Integer> s1 = new Stack<>(new ArrayList<>());
        s1.push(1);
        s1.push(2);
        s1.push(3);
        s1.push(4);
        s1.push(5);
        System.out.println("Integer stack average: " + s1.average());

        Stack<Double> s2 = new Stack<>(new ArrayList<>());
        s2.push(1.1);
        s2.push(2.2);
        s2.push(3.3);
        s2.push(4.4);
        s2.push(5.5);
        System.out.println("Double stack average: " + s2.average());

        System.out.println("Same average? " + s1.compareAverage(s2));
    }
}
import java.util.*;

class Node {
    String key;
    String value;
    Node next;

    Node(String key, String value) {
        this.key = key;
        this.value = value;
        this.next = null;
    }
}

class SeparateChaining {
    private Node[] table;
    private int size;

    SeparateChaining(int capacity) {
        table = new Node[capacity];
        size = capacity;
    }

    private int hash(String key) {
        return Math.abs(key.hashCode()) % size;
    }

    public void put(String key, String value) {
        int index = hash(key);
        Node newNode = new Node(key, value);
        if (table[index] == null) {
            table[index] = newNode;
        } else {
            Node current = table[index];
            while (current.next != null) {
                if (current.key.equals(key)) {
                    current.value = value;
                    return;
                }
                current = current.next;
            }
            current.next = newNode;
        }
    }

    public String get(String key) {
        int index = hash(key);
        Node current = table[index];
        while (current != null) {
            if (current.key.equals(key)) {
                return current.value;
            }
            current = current.next;
        }
        return null;
    }

    public void print() {
        System.out.println("Hash Table (Separate Chaining)");
        for (int i = 0; i < size; i++) {
            Node current = table[i];
            System.out.print("Index " + i + ": ");
            while (current != null) {
                System.out.print("(" + current.key + ", " + current.value + ") -> ");
                current = current.next;
            }
            System.out.println("null");
        }
    }
}

public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter size of hash table:");
        int size = scanner.nextInt();
        SeparateChaining separateChaining = new SeparateChaining(size);

        System.out.println("Enter key-value pairs (key value):");
        for (int i = 0; i < size; i++) {
            String key = scanner.next();
            String value = scanner.next();
            separateChaining.put(key, value);
        }

        separateChaining.print();

        System.out.println("Enter a key to retrieve its value:");
        String key = scanner.next();
        String retrievedValue = separateChaining.get(key);
        if (retrievedValue != null) {
            System.out.println("Value for key " + key + " is: " + retrievedValue);
        } else {
            System.out.println("Key not found.");
        }
        scanner.close();
    }
}
import java.util.*;

public class QuadraticProbing<T>
{   
	private static final int DEFAULT_TABLE_SIZE = 101;
	private HashEntry<T>[] array;
	private int currentSize;
	
	public QuadraticProbing()
	{	this(DEFAULT_TABLE_SIZE); }
	
	public QuadraticProbing(int size)
	{	array = new HashEntry[size]; 
		makeEmpty();
	}
	
	public void makeEmpty()
	{   currentSize = 0;
		for(int i=0; i<array.length; i++)
			array[i] = null;
	}
	
	public boolean contains(T element)
	{
		int currentPos = findPos(element);
		return isActive(currentPos);
	}
	
	private int findPos(T element)
	{
		int offset = 1;
		int currentPos = myhash(element);
		while(array[currentPos]!=null&&!array[currentPos].element.equals(element))
		{
			currentPos += offset;
			offset += 2;
			if(currentPos>=array.length)
				currentPos -= array.length;
		}
		return currentPos;
	}
	
	private boolean isActive(int currentPos)
	{
		return array[currentPos]!=null && array[currentPos].isActive;
	}
	
	public void insert(T element)
	{
		int currentPos = findPos(element);
		if(isActive(currentPos))
			return;
		array[currentPos] = new HashEntry<>(element, true);
	}
	
	public void remove(T element)
	{
		int currentPos = findPos(element);
		if(isActive(currentPos))
				array[currentPos].isActive = false;
	}
	
	private int myhash(T element)
	{   
		int hashValue = element.hashCode();
		hashValue %= array.length;
		if(hashValue < 0)
			hashValue += array.length;
		return hashValue;
	}
	
	private static class HashEntry<T>
	{
		public T element;
		public boolean isActive;
		
		public HashEntry(T e)
		{ this(e, true); }
		
		public HashEntry(T e, boolean i)
		{ element = e; isActive = i; }
		
		public T getElement(){ return this.element; }
	}
	
	public void showAll()
	{   for(HashEntry each: array)
			if(each != null)
				System.out.print(each.getElement()+"  ");
			else
				System.out.print("None ");
	}
	
	public static void main(String[] args)
	{
		QuadraticProbing<Integer> sc = new QuadraticProbing(10);
		sc.insert(89); sc.insert(18); sc.insert(49); sc.insert(58); sc.insert(69); 
		sc.showAll();
		
	}
}
 
public class Container {
    private Object obj;

    public Container(Object obj) {
        this.obj = obj;
    }

    public Object getObj() {
        return this.obj;
    }

    public void showType() {
        System.out.println("Type is: " + obj.getClass().getName());
    }

    public static void main(String[] args) {
        // Container for a String
        Container c1 = new Container("Generics");
        String s = (String) c1.getObj();
        System.out.println("String is: " + s);
        c1.showType();

        // Container for an Integer
        Container c2 = new Container(123);
        int i = (Integer) c2.getObj();
        System.out.println("Integer is: " + i);
        c2.showType();
    }
}


MyRandom.java:


public interface MyRandom {
    double generate();
}


MyRandomDemo.java:


public class MyRandomDemo {
    public static void main(String[] args) {
        MyRandom random = () -> Math.random();

        System.out.println("Random number: " + random.generate());
    }
}
import java.util.*; 
public class LinkedListDemo 
{ 
public static void main(String[] args) 
{ 
LinkedList<String> ll = new LinkedList<>(); 
ll.add("first"); ll.add("second"); ll.add("fourth"); 
System.out.println("Contents: " + ll); 
System.out.println(); 
ll.add(2, "third"); ll.addFirst("zero"); 
System.out.println("Contents: " + ll); 
System.out.println(); 

} 
}
import java.util.*; 
 
public class LinkedHashSetDemo 
{ 
 public static void main(String[] args) 
 { 
  LinkedHashSet<String> hs = new LinkedHashSet<>(); 
   
  hs.add("first"); hs.add("second"); hs.add("third");  
  hs.add("fourth"); hs.add("fifth"); hs.add("sixth"); 
   
  System.out.println("Contents: " + hs); 
  System.out.println("Size: " + hs.size()); 
  System.out.println(); 
   
  Object[] arrayS = hs.toArray(); 
  for(Object each: arrayS) 
   System.out.println(each); 
   
  System.out.println(); 
  String[] arrayS2 = new String[hs.size()]; 
  arrayS2 = hs.toArray(arrayS2); 
  for( String each: arrayS2) 
   System.out.println(each); 
   
  System.out.println(); 
  Iterator it = hs.iterator(); 
  while(it.hasNext()) 
   System.out.println(it.next()); 
   
  System.out.println(); 
  System.out.println("Empty? " + hs.isEmpty()); 
  System.out.println(); 
   
  hs.remove("fourth"); 
  System.out.println("Contents: " + hs); 
  System.out.println("Size: " + hs.size()); 
 } 
}  
import java.util.*; 
 
public class LinkedHashMapDemo 
{ 
 public static void main(String[] args) 
 { 
  LinkedHashMap<String, Integer> hm = new LinkedHashMap<>(); 
  hm.put("Anand", 20); 
  hm.put("Mary", 20); 
  hm.put("Ravi", 21); 
  hm.put("John",19); 
  System.out.println("Contents: "+hm); 
   
  System.out.println(); 
  Set<String> keys = hm.keySet(); 
  for(String k: keys) 
   System.out.println(k+" -- "+hm.get(k)); 
   
  System.out.println(); 
   
  Set<Map.Entry<String, Integer>> entries = hm.entrySet(); 
  for(Map.Entry<String,Integer> each: entries) 
   System.out.println(each.getKey()+" -- "+each.getValue()); 
   
  System.out.println(); 
 } 
}
import java.util.*;

interface Value{
	public Double pi();
}
public class LambdaPI{
	public static void main(String args[]){
		Value pi = ()-> {
			return 3.14;
		};
		System.out.print("PI value: "+pi.pi());
	}
}
import java.util.Scanner;

interface Test {
    boolean check(int n);
}

public class LambdaTest {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        
        Test isEven = n -> (n % 2) == 0;
        Test isNonNegative = n -> n >= 0;
        
        System.out.print("Enter a number: ");
        int x = scan.nextInt();
        System.out.println(x + " is even? " + isEven.check(x));

        System.out.print("Enter another number: ");
        x = scan.nextInt();
        System.out.println(x + " is non-negative? " + isNonNegative.check(x));
    }
}
public class LambdaDemo
{
	public static void main(String[] args)
	{
		MyNum num = () -> 123.456;
		System.out.println("This is the value: " + num.getNum());
		
		num = () -> Math.random() * 100;
		System.out.println("This is the random value: " + num.getNum());
		System.out.println("This is one more random value: " + num.getNum());
	}
}
##Box.java:

class Box<T> {
    private T value;
    public Box(T value) 
    { 
        this.value = value; 
        
    }
    public T getValue() 
    { 
        return value; 
        
    }
}

class GenericBox<T> extends Box<T> {
    public GenericBox(T value) { super(value); }
    public void display() { System.out.println("Value: " + getValue()); }
}



##InheritanceWithGenerics.java

public class InheritanceWithGenerics {
    public static void main(String[] args) {
        Box<Integer> integerBox = new Box<>(10);
        System.out.println("Integer Value: " + integerBox.getValue());

        GenericBox<String> stringBox = new GenericBox<>("Hello");
        stringBox.display();
    }
}
import java.util.*; 
 
public class HashSetDemo 
{ 
 public static void main(String[] args) 
 { 
  HashSet<String> hs = new HashSet<>(); 
   
  hs.add("first"); hs.add("second"); hs.add("third");  
  hs.add("fourth"); hs.add("fifth"); hs.add("sixth"); 
   
  System.out.println("Contents: " + hs); 
  System.out.println("Size: " + hs.size()); 
  System.out.println(); 
   
  Object[] arrayS = hs.toArray(); 
  for(Object each: arrayS) 
   System.out.println(each); 
   
  System.out.println(); 
  String[] arrayS2 = new String[hs.size()]; 
  arrayS2 = hs.toArray(arrayS2); 
  for( String each: arrayS2) 
   System.out.println(each); 
   
  System.out.println(); 
  Iterator it = hs.iterator(); 
  while(it.hasNext()) 
   System.out.println(it.next()); 
   
  System.out.println(); 
  System.out.println("Empty? " + hs.isEmpty()); 
  System.out.println(); 
   
  hs.remove("fourth"); 
  System.out.println("Contents: " + hs); 
  System.out.println("Size: " + hs.size()); 
 } 
} 
 
import java.util.*; 
 
public class HashMapDemo 
{ 
 public static void main(String[] args) 
 { 
  HashMap<String, Integer> hm = new HashMap<>(); 
  hm.put("Anand", 20); 
  hm.put("Mary", 20); 
  hm.put("Ravi", 21); 
  hm.put("John",19); 
  System.out.println("Contents: "+hm); 
   
  System.out.println(); 
  Set<String> keys = hm.keySet(); 
  for(String k: keys) 
   System.out.println(k+" -- "+hm.get(k)); 
   
  System.out.println(); 
   
  Set<Map.Entry<String, Integer>> entries = hm.entrySet(); 
  for(Map.Entry<String,Integer> each: entries) 
   System.out.println(each.getKey()+" -- "+each.getValue()); 
   
  System.out.println(); 
 } 
} 
public class Container<T> {
    private T obj;

    public Container(T obj) {
        this.obj = obj;
    }

    public T getObj() {
        return this.obj;
    }

    public void showType() {
        System.out.println("Type is: " + obj.getClass().getName());
    }

    public static void main(String[] args) {
        // Container for a String
        Container<String> c1 = new Container<>("Generics");
        String s = c1.getObj();
        System.out.println("String is: " + s);
        c1.showType();

        // Container for an Integer
        Container<Integer> c2 = new Container<>(123);
        int i = c2.getObj();
        System.out.println("Integer is: " + i);
        c2.showType();
    }
}
public class Pair<K, V> {
    private K key;
    private V value;

    public Pair(K key, V value) {
        this.key = key;
        this.value = value;
    }

    public K getKey() {
        return this.key;
    }

    public V getValue() {
        return this.value;
    }

    public static void main(String[] args) {
        Pair<Integer, String> p1 = new Pair<>(123, "Generics");
        Integer key = p1.getKey();
        String value = p1.getValue();
        System.out.println("Key: " + key);
        System.out.println("Value: " + value);
    }
}
import java.util.*;
class StackULLC{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		LinkedList l = new LinkedList();
		int op=0;
		System.out.println("1.Push\n2.Pop\n3.Display\n4.Exit");
		while(op!=4){
			System.out.print("Enter option:");
			op = sc.nextInt();
			switch(op){
				case 1: System.out.println("Enter data: ");
						int d = sc.nextInt();
						l.addFirst(d);
						break;
				case 2: System.out.println("Poped: "+l.removeFirst());
						break;
				case 3: 
				LinkedList temp =new LinkedList(l);
				while(!temp.isEmpty()){
					System.out.print(temp.getFirst()+"   ");
					temp.removeFirst();	
				};System.out.println();
				break;
				case 4: break;
			}
		}
	}
}
import java.util.*;
 
public class GenStackAL<T> {
    ArrayList<T> stack;
	GenStackAL(ArrayList<T> stack){
		this.stack=stack;
	}
	void push(T a){
        stack.add(a);
	}
	T pop(){
		if(stack.size()==0){
			return null;
		}
		else{
            T i= stack.remove(stack.size()-1);
			return i;
		}
		
	}
	void display(){
		if(stack.size()==0){
			System.out.println("Stack is empty");
		}
		else{
			for(int i=stack.size()-1;i>=0;i--){
				System.out.println(stack.get(i));
			}
		}
	}
	
	public static void main(String args[]){
		Scanner sc= new Scanner(System.in);
		ArrayList<Integer> a= new ArrayList<>();
		GenStackAL<Integer> s1= new GenStackAL<>(a);
		
		int op=0;
		Integer ele;
		System.out.println("1.push\n2.pop\n3.Display\n4.Exit");
		while(op!=4){
			
			System.out.print("Enter option: ");
			op=sc.nextInt();
			switch(op){
				case 1:
					System.out.println("enter element to push: ");
					ele = sc.nextInt();
					s1.push(ele);
					break;
				case 2:
					ele=s1.pop();
					if(ele==null){
						System.out.println("Stack is empty");
					}
					else{
						System.out.println("Poped element:"+ele);
					}
					break;
				case 3:
					s1.display();
					break;
				case 4:
					return;
				default :
					System.out.println("Enter valid option");
					
			}
		}
	}
}
import java.util.*;
class GenStack<T>{
	T stack[];
	int top=-1;
	GenStack(T stack[]){
		this.stack=stack;
	}
	void push(T a){
		if((top+1)==stack.length){
			System.out.println("Stack is full");
		}
		else{
			stack[top+1]=a;
			top=top+1;
		}
	}
	T pop(){
		if(top== -1){
			System.out.println("Stack is empty");
			return null;
		}
		else{
			T i= stack[top];
			top--;
			return i;
		}
		
	}
	void display(){
		if(top==-1){
			System.out.println("Stack is empty");
		}
		else{
			for(int i=top;i>-1;i--){
				System.out.println(stack[i]);
			}
		}
	}
	public static void main(String args[]){
		Scanner sc= new Scanner(System.in);
		System.out.print("Enter size of stack");
		int n=sc.nextInt();
		Integer a[]= new Integer[n];
		GenStack<Integer> s1= new GenStack<Integer>(a);
		s1.push(101);
		s1.push(102);
		s1.push(103);
		s1.push(104);
		s1.push(105);
		s1.display();
		Integer i =s1.pop();
		System.out.println("poped : "+i);
	}
}
import java.util.LinkedList;
 
class GenericQueue<T> {
    private LinkedList<T> queue;
 
    public GenericQueue() {
        queue = new LinkedList<>();
    }
 
    // Method to add an element to the queue
    public void enqueue(T element) {
        queue.addLast(element);
    }
 
    // Method to remove and return the element at the front of the queue
    public T dequeue() {
        if (isEmpty()) {
            throw new IllegalStateException("Queue is empty");
        }
        return queue.removeFirst();
    }
 
    // Method to check if the queue is empty
    public boolean isEmpty() {
        return queue.isEmpty();
    }
 
    // Method to get the size of the queue
    public int size() {
        return queue.size();
    }
}
 
public class Main {
    public static void main(String[] args) {
        GenericQueue<String> stringQueue = new GenericQueue<>();
 
        // Enqueue some elements
        stringQueue.enqueue("First");
        stringQueue.enqueue("Second");
        stringQueue.enqueue("Third");
 
        // Dequeue and print elements
        System.out.println("Dequeueing elements:");
        while (!stringQueue.isEmpty()) {
            System.out.println(stringQueue.dequeue());
        }
    }
}
 
import java.util.*;
class GenQueueAL<T>{
	ArrayList<T> queue;
	GenQueueAL(ArrayList<T> queue){
		this.queue=queue;
	}
	void enqueue(T a){
			queue.add(a);
	}
	T dequeue(){
		T i= null;
		try{
			i= queue.remove(0);
		}catch(Exception e){
			i= null;
		}
		
		return i;
	}
	void display(){
		for(T i:queue){
			System.out.println(i);
		}
	}
	
	public static void main(String args[]){
		Scanner sc= new Scanner(System.in);
		ArrayList<Integer> a= new ArrayList<>();
		GenQueueAL<Integer> q1= new GenQueueAL<Integer>(a);
		int op=0;
		Integer ele;
		System.out.println("1.Enqueue\n2.Dequeue\n3.Display\n4.Exit");
		while(op!=4){
			
			System.out.print("Enter option: ");
			op=sc.nextInt();
			switch(op){
				case 1:
					System.out.println("enter element to enqueue: ");
					ele = sc.nextInt();
					q1.enqueue(ele);
					break;
				case 2:
					ele=q1.dequeue();
					if(ele==null){
						System.out.println("Queue is empty");
					}
					else{
						System.out.println("Dequeued element:"+ele);
					}
					break;
				case 3:
					q1.display();
					break;
				case 4:
					break;
				default :
					System.out.println("Enter valid option");
					
			}
		}
	}
		
		
	}
interface MyFunction<T> {
    T compute(T value);
}

public class GenericLambda {
    public static void main(String[] args) {
        MyFunction<String> reverse = s -> new StringBuilder(s).reverse().toString();
        MyFunction<Integer> factorial = n -> {
            int result = 1;
            for (int i = 2; i <= n; i++) result *= i;
            return result;
        };

        System.out.println("Reversed string: " + reverse.compute("Lambda"));
        System.out.println("Factorial: " + factorial.compute(5));
    }
}
import java.util.Scanner;

interface Factorial {
    int calculate(int n);
}

public class LambdaFactorial {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter a number: ");
        int n = scanner.nextInt();

        Factorial factorial = (num) -> {
            int result = 1;
            for (int i = 2; i <= num; i++) {
                result *= i;
            }
            return result;
        };

        System.out.println("Factorial of " + n + ": " + factorial.calculate(n));
    }
}
interface MyOperation {
    void performOperation() throws Exception;
}

public class ExceptionLambdaDemo {
    public static void main(String[] args) {
        MyOperation operation = () -> {
       
            throw new Exception("Exception thrown from lambda expression");
        };

        try {
            operation.performOperation();
        } catch (Exception e) {
            System.out.println("Exception caught: " + e.getMessage());
        }
    }
}
interface ExceptionDemo
{ String compute(String s) throws NullPointerException; }

class DemoOfLambdaException
{   public static void main(String[] args)
	{
		ExceptionDemo ed = (str) -> {
		if(str.length()==0 || str==null)
			throw new NullPointerException("No String is available");
		else
			return "The string "+str+" has "+str.length()+" characters.";
	};
	
	java.util.Scanner scan = new java.util.Scanner(System.in);
	System.out.println("Enter a String: ");
	String s = scan.nextLine();
	System.out.println(ed.compute(s));
	}
}
interface Numbers
{ public abstract boolean checkFactor(int n, int m); }

public class LambdaFactor
{
	public static void main(String[] args)
	{
		java.util.Scanner scan = new java.util.Scanner(System.in);
		
		Numbers factor = (n, m) -> (n%m)==0;
		
		System.out.println("Enter two numbers: ");
		int n = scan.nextInt(); int m = scan.nextInt();
		System.out.println(m + " is a factor of " + n + ": " + factor.checkFactor(n, m));
	}
}
star

Wed May 29 2024 19:18:55 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:18:33 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:18:15 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:15:15 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:14:39 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:14:18 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:14:00 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:13:23 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 19:12:49 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 18:58:04 GMT+0000 (Coordinated Universal Time)

@Muhammad_Waqar

star

Wed May 29 2024 18:42:41 GMT+0000 (Coordinated Universal Time)

@Yashu #java

star

Wed May 29 2024 18:03:55 GMT+0000 (Coordinated Universal Time) https://www.freecodecamp.org/news/how-to-create-a-rest-api-without-a-server/?ref

@saibrahmam #javascript

star

Wed May 29 2024 17:04:09 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 17:03:48 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 17:03:20 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 17:03:02 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 17:02:43 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 17:02:17 GMT+0000 (Coordinated Universal Time)

@exam123

star

Wed May 29 2024 16:58:41 GMT+0000 (Coordinated Universal Time)

@shirnunn

star

Wed May 29 2024 16:52:30 GMT+0000 (Coordinated Universal Time) https://termsandconditions.com/

@shookthacr3ator

star

Wed May 29 2024 16:48:11 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:47:20 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:46:54 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:46:19 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:45:50 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:45:20 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:43:38 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:43:01 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:42:19 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:41:42 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:40:49 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:39:26 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:39:04 GMT+0000 (Coordinated Universal Time) https://www.kodemuse.dev/documentation-design-analysis/

@shookthacr3ator

star

Wed May 29 2024 16:38:54 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:38:00 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:36:18 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:35:34 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:35:03 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:34:31 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:33:55 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:33:18 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:32:43 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:31:38 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:29:33 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:29:00 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:27:27 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:26:54 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:26:18 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:25:36 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 16:24:54 GMT+0000 (Coordinated Universal Time)

@signup

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension