Drupal 8: Bootstrap Sticky is not sticky in Drupal 8 - Solved
Bootstrap has a simple solution to have sticky blocks in your html. I’ve given a…
July 04, 2019
Suppose you have two lists, and you want Union and Intersection of those two lists.
Input:
list1: [1, 2, 3, 4]
list2: [3, 4, 5, 6]
union(list1, list2): [1, 2, 3, 4, 5, 6]
intersection(list1, list2): [3, 4]
See the java code for multiple solutions:
public static List<Integer> getIntersection_1(List<Integer> l1, List<Integer> l2) {
return l1.stream().filter(l2::contains).collect(Collectors.toList());
}
public static List<Integer> getIntersection_2(List<Integer> l1, List<Integer> l2) {
Set<Integer> s1 = new HashSet<>(l1);
s1.retainAll(l2);
return new ArrayList<>(s1);
}
public static List<Integer> getIntersection_3(List<Integer> l1, List<Integer> l2) {
List<Integer> list = new ArrayList<Integer>();
for (Integer i : l1) {
if(l2.contains(i)) {
list.add(i);
}
}
return list;
}
public static List<Integer> getUnion_1(List<Integer> l1, List<Integer> l2) {
Set<Integer> result = new HashSet<Integer>();
result.addAll(l1);
result.addAll(l2);
return new ArrayList<Integer>(result);
}
public static List<Integer> getUnion_2(List<Integer> l1, List<Integer> l2) {
Set<Integer> s1 = new HashSet<>(l1);
s1.addAll(l2);
return new ArrayList<>(s1);
}
Bootstrap has a simple solution to have sticky blocks in your html. I’ve given a…
Introduction In this guide, we will see git basic commands, and fundamentals of…
Introduction In some of the cases, we need to specify namespace name along with…
Introduction I have created a view, with some filters and content fields. I will…
In previous article: Effective Git Branching Strategy, I discussed Git branching…
Introduction In last post, we saw How to read CSV with Headers into Dictionary…
Introduction In this post we will see following: How to schedule a job on cron…
Introduction There are some cases, where I need another git repository while…
Introduction In this post, we will see how to fetch multiple credentials and…
Introduction I have an automation script, that I want to run on different…
Introduction I had to write a CICD system for one of our project. I had to…
Introduction Java log4j has many ways to initialize and append the desired…