Snippets Collections
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));
	}
}
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.*; 
 
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
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 "); 
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 
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));
	}
}
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));
		
	}
}
//Source.ccp

//Setup SDL
bool InitSDL() {
	//If failed to Initialize
	if (SDL_Init(SDL_INIT_VIDEO) < 0) {
		cout << "Failed to Init SDL. Error: " << SDL_GetError() << "\n";
		return false;
	}

	//If Sucesss
	else {
		//Create Window
		gWindow = SDL_CreateWindow("MarioBrosClone", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN); 
		
		//Create renderer
		gRenderer = SDL_CreateRenderer(gWindow, -1, SDL_RENDERER_ACCELERATED);

		//Check if Window is null
		if (gWindow == NULL) {
			cout << "Failed to create Window, Error: " << SDL_GetError() << "\n";
			return false;
		}

		//Check if renderer is null;
		if (gRenderer == NULL) {
			cout << "Failed to create Renderer, Error " << SDL_GetError() << "\n";
			return false;
		}

		//Set Texture
		else {
			int imageFlags = IMG_INIT_PNG;

			if (!(IMG_Init(imageFlags)) && imageFlags) {
				cout << "Failed to load SDL_Image, Error " << SDL_GetError() << "\n";
				return false;
			}
		}

		//Create Mixer
		if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0) {
			cout << "Mixer could not initialise. Error: " << Mix_GetError();
			return false;
		}

		if (TTF_Init() < 0) {
			cout << "Error: " << TTF_GetError() << endl;
			return false;
		}
	}

	return true;
}

//Close SDL
void CloseSDL() {
	SDL_DestroyWindow(gWindow);
	gWindow = NULL;

	IMG_Quit();
	SDL_Quit();

	SDL_DestroyRenderer(gRenderer);
	gRenderer = NULL;

	delete gTexture;
	gTexture = NULL;

	delete gameScreenManager;
	gameScreenManager = NULL;
}

//Render 
void Render() {
	//Clear Screen
	SDL_SetRenderDrawColor(gRenderer, 0x00, 0x00, 0x00, 0x00);
	SDL_RenderClear(gRenderer);
	
	//Render Texture to Screen
	gameScreenManager->Render();

	//Update Screen
	SDL_RenderPresent(gRenderer);
}
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()); 
   
 } 
} 
  
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]);
	}
}
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));
	}
}
Buy 2000cc Pmma buttock injections
https://darkwebmarketbuyer.com/product/2000cc-pmma-buttock-injections/
Buy PMMA buttock injection
Our 2000cc PMMA buttock injections are the perfect solution for anyone looking to enhance their curves and achieve a more voluptuous figure. Made with high-quality PMMA microspheres, our injections provide long-lasting results that will leave you feeling confident and beautiful.

How It Works
PMMA buttock injections work by adding volume to the buttocks and hips, creating a more shapely figure. The PMMA microspheres are suspended in a sterile gel that is injected into the targeted area, allowing the microspheres to distribute evenly and create a natural-looking result. Over time, the body naturally metabolizes the gel, leaving behind the PMMA microspheres which continue to provide volume and shape.

Benefits
Long-lasting results
Natural-looking enhancement
Minimally invasive procedure
Safe and effective
Quick recovery time
Precautions
As with any medical procedure, there are some precautions that you should take before undergoing PMMA buttock injections. It’s important to discuss your medical history and any medications you are taking with your doctor, as some conditions and medications may interfere with the procedure. Additionally, you should avoid smoking and drinking alcohol before and after the procedure, as these activities can impair healing and increase the risk of complications. Pmma buttock injection for sale

https://darkwebmarketbuyer.com/product-category/pills/butt-breast-enlargement/

Side Effects
While PMMA buttock injections are generally safe, there are some side effects that you should be aware of, including swelling, bruising, and redness at the injection site. These side effects typically subside within a few days, but your doctor may recommend pain medication or other treatments to help manage any discomfort. It’s important to follow all post-procedure instructions provided by your doctor to minimize the risk of complications.

https://darkwebmarketbuyer.com/product/buy-1000cc-pmma-buttock-injections-online/

Buy 2000cc Pmma Buttock Injections Online
https://darkwebmarketbuyer.com/product/2000cc-pmma-buttock-injections/

Looking to buy 2000cc PMMA buttock injections online? Look no further than our authorized E-commerce website. We are committed to providing high-quality, safe, and effective beauty medicine products, and our PMMA buttock injections are no exception. Place your order today and start enjoying a more confident and beautiful you!
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDDy4LCTXRoGIGmuRex/9FkJLHxMd5KQFn0oTXhgc4wfW/YzU99U+JUSfbDpzqtMmzppKwtUSJ8fUPor7EqBA9FvRsWsm9JEAvj4REjiyNv0H22Msh8nFx71oKYSehOYpvm4WEBM9d7UL05kI0RbatK59ZtFrPR85qqFtLW6CkLBCFGNldbs+3hBN9gHsDrBXAVD8gurFgNmzyxd3Rh9tpncmliCVsUplQdAZqSo06mKIEIClWaVmps+v7tIkeqb+BM2SbmgD5pGm19gk8nFmk05DRob++nIL6VBBtH3Jd7gkzj9nggPbA8/Tjp+dxXK8uQEUylUoLyezVBKdVtsK9X2ytPIr/0797IOoS0AMVLlqaYO6wxxtGqS9M7EpvHsd2V9XPb3yciZftuul0YsGey14+OOPeupwD9cRdYjTEOUAl8wKD+8bnyOy1bb3Lb1FdfT/5JmsbHdLglKXzfaqoVXK+klNzzde7MV2jMDsh5iU1NZb1EMZzUjPTdOB63MEt2xC0ziBt8+JZd1N6aQ1wLUZ72UlTzSriID0mfq3Gt27VaUr58lFNmmljnKcBOy4LXfzDQxcSzRsm4Xo3SYt8vOeOag47ZOITD/JFQgurWFwk8V5nk6WXYGt4zCwZU7lXY5Crvx9u47FnFVk0N0U4A8Lz56+gkQUWsOkrnd03sbw==
library(dplyr, warn.conflicts = FALSE)
library(tidyr)
library(ggplot2)
library(NHSRdatasets)
library(janitor, warn.conflicts = FALSE) # to clean the titles and making them snake_case

ons_mortality <- NHSRdatasets::ons_mortality

deaths_data <- ons_mortality |>
  filter(date > "2020-01-01",
         category_2 %in% c("all ages", "Yorkshire and The Humber")) |>
  pivot_wider(
    id_cols = c(date, week_no),
    values_from = counts,
    names_from = category_2
  ) |>
  clean_names()

ggplot(data = deaths_data) +
  geom_line(aes(
    x = date, 
    y = all_ages,
    col = "all ages"
  )) +
  geom_line(aes(
    x = date, 
    y = yorkshire_and_the_humber,
    col = "Yorkshire and The Humber"
  )) +
  scale_y_continuous(
    name = "Yorkshire and The Humber",
    breaks = scales::pretty_breaks(10),
    sec.axis = sec_axis(~ . * 10,
                        name = "all ages",
                        breaks = scales::pretty_breaks(10)
    )
  ) +
  scale_colour_manual(
    name = NULL,
    values = c(
      "all ages" = "#CC2200",
      "Yorkshire and The Humber" = "black"
    )
  )
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();
 }
}
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();
}
}
interface Refer
{ String m(String s); }

class StringOperation
{
	String reverse(String s)
	{   String res = "";
		for(int i=s.length()-1; i>=0; i--)
			res += s.charAt(i);
		return res;
	}
}

public class ReferDemo
{ 	
    static String compute(Refer r, String s)
	{ return r.m(s); }
	
    public static void main(String[] args)
	{   String s = "sample string";
		System.out.println(compute(new StringOperation()::reverse, s));
		/*
		Refer ob = (str)->{
			String res = "";
		for(int i=s.length()-1; i>=0; i--)
			res += s.charAt(i);
		return res;
		};
		
		System.out.println(compute(ob, s));
		*/
	}
}
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

star

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

@signup

star

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

@signup

star

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

@signup

star

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

@signup

star

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

@signup

star

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

@huyrtb123 #c++

star

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

@signup

star

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

@signup

star

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

@signup

star

Wed May 29 2024 16:10:32 GMT+0000 (Coordinated Universal Time) https://account.live.com/proofs/manage/additional?mkt

@shookthacr3ator

star

Wed May 29 2024 16:06:58 GMT+0000 (Coordinated Universal Time) https://darkwebmarketbuyer.com/product/2000cc-pmma-buttock-injections/

@darkwebmarket

star

Wed May 29 2024 16:05:25 GMT+0000 (Coordinated Universal Time) https://darkwebmarketbuyer.com/product/2000cc-pmma-buttock-injections/

@darkwebmarket

star

Wed May 29 2024 15:58:15 GMT+0000 (Coordinated Universal Time) https://s1477.usc1.mysecurecloudhost.com:2083/cpsess1902818660/frontend/jupiter/telnet/keys/editkey.html?key

@shookthacr3ator

star

Wed May 29 2024 15:39:23 GMT+0000 (Coordinated Universal Time) https://extensions.dev/

@shookthacr3ator

star

Wed May 29 2024 15:25:57 GMT+0000 (Coordinated Universal Time) https://nhsrcommunity.com/code-snippets-2-scale-y-axes-in-ggplot2/

@andrewbruce #r

star

Wed May 29 2024 14:19:37 GMT+0000 (Coordinated Universal Time) https://www.creativefabrica.com/studio/

@shookthacr3ator

star

Wed May 29 2024 14:18:02 GMT+0000 (Coordinated Universal Time) https://www.creativefabrica.com/freebies/

@shookthacr3ator

star

Wed May 29 2024 14:16:39 GMT+0000 (Coordinated Universal Time) https://www.creativefabrica.com/freebies/

@shookthacr3ator

star

Wed May 29 2024 14:08:33 GMT+0000 (Coordinated Universal Time) https://www.vecteezy.com/reverse-image-search

@shookthacr3ator

star

Wed May 29 2024 14:08:00 GMT+0000 (Coordinated Universal Time) https://www.vecteezy.com/developers

@shookthacr3ator

star

Wed May 29 2024 14:04:50 GMT+0000 (Coordinated Universal Time) https://www.freepik.com/developers/dashboard/api-key

@shookthacr3ator

star

Wed May 29 2024 14:04:28 GMT+0000 (Coordinated Universal Time) https://docs.freepik.com/api-reference/introduction

@shookthacr3ator

star

Wed May 29 2024 14:03:31 GMT+0000 (Coordinated Universal Time) https://www.freepik.com/api?_gl

@shookthacr3ator

star

Wed May 29 2024 13:38:32 GMT+0000 (Coordinated Universal Time) https://icons8.com/icons

@shookthacr3ator

star

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

@signup

star

Wed May 29 2024 13:37:05 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 29 2024 13:23:48 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