This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
// temp: input array | |
// n: size of array | |
//Function to rearrange the array elements alternately. | |
public static void rearrange(int arr[], int n){ | |
for (int i = 0; i < arr.length; i++) { | |
int index = i; | |
int next = arr[index]; | |
if (next < 0) continue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Timer { | |
long startTime = System.currentTimeMillis() | |
static Timer start() { | |
new Timer() | |
} | |
long timeSpent() { | |
System.currentTimeMillis() - startTime | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.doublescoring.socredit | |
class Customer { | |
List<Order> orders; | |
} | |
class Order { | |
List<String> products; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.doublescoring.socredit; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
public class Test { | |
public static void main(String[] args) { | |
int size = Arrays.asList(new OrderList(Arrays.asList(new Order(Arrays.asList("гавно", "шлак"))))) | |
.stream() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.doublescoring.socredit.domain; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
public class Event { | |
private ExecutorService executor = Executors.newCachedThreadPool(); | |
private Runnable errorHandler; | |
private Runnable successHandler; | |
private final Object lock = new Object(); |