Skip to content

Instantly share code, notes, and snippets.

View sidd-kulk's full-sized avatar

Siddharth Kulkarni sidd-kulk

View GitHub Profile
import java.io.*;
import java.util.*;
public class BRC {
public static void main(String[] args) throws FileNotFoundException {
long millis = System.currentTimeMillis();
System.out.println(calculateMinMeanMaxPerStation(readCSV()));
System.out.println("Time taken = " + (System.currentTimeMillis() - millis));
}
package com.springbootwebcsocket.demo;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;
//@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) throws InterruptedException {
public class Customer {
public String type;
}
public class ProcessOrder
{
public int getOrderGrandTotal(Customer customer, int subTotal)
{
if (customer.type.equals("EMPLOYEE"))
{
enum COLOR {
WHITE, BLACK
}
enum PIECE {
NONE, BISHOP, KING // etc.
}
class Cell {
private COLOR color; // Enum, white or black
class Employee {
private int id;
private int yearOfBirth;
private int monthOfBirth;
private int dateOfBirth;
private String addressFlat;
private String addressStreet;
private String city;
private String state;
private String pincode;
@sidd-kulk
sidd-kulk / Indentation.java
Last active May 25, 2021 08:50
Indentation
public String doStuff(StringBuffer data) {
if(data != null) {
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
data.append(String.valueOf(i+j));
}
data.append("\n");
}
} else {
class Library (val books: MutableList<Book>) {
fun getBooks(): MutableList<Book> {
...
}
fun addBook(book: Book) {
...
}
}
class Library (var books: MutableList<Book>) {
fun getBooks(): MutableList<Book> {
...
}
fun setBooks(newBooks: MutableList<Book>) {
...
}
@sidd-kulk
sidd-kulk / OperatorOverload.kt
Created June 21, 2019 11:31
Kotlin code sample
fun main() {
val s = Square(2.0)
println(s.area()) // Prints 4.0, duh!
println(s - Square(3.0)) // Prints -5.0, Sweet!
}
data class Square (val side: Double) {
operator fun minus(other: Square): Double {
return this.area() - other.area()
}
//.. Imports
public class ReportGenerator {
private final HttpServletRequest request;
private final WebDriver webDriver;
public ReportGenerator(HttpServletRequest request){
this.request = request;
this.webDriver = new ChromeDriver(...);
}