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
/** | |
* A java program to reverse a string using recursion. | |
* | |
* @author gaurav | |
* | |
*/ | |
public class ReverseStringUsingRecursion { | |
public static void main(String[] args) { | |
String str = "hello"; |
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
/** | |
* A java program to traverse the array using the | |
* for-each loop i.e. enhanced for loop | |
* | |
* @author Guarav Kukade at coderolls.com | |
* | |
*/ | |
public class ArrayForEachExample { | |
public static void main(String[] args) { |
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
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* A java program to iterate through arraylist | |
* using forEach method and lamda expression. | |
* | |
* @author Gaurav Kukade at coderolls.com | |
* | |
*/ |
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
/** | |
* A java program to iterate through arraylist | |
* using Iterator interface. | |
* | |
* @author Gaurav Kukade at coderolls.com | |
* | |
*/ | |
public class ArrayListIterateExample4 { | |
public static void main (String[] args) { |
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
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* A java program to iterate through arraylist | |
* using while loop. | |
* | |
* @author Gaurav Kukade at coderolls.com | |
* | |
*/ |
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
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* A java program to iterate through arraylist | |
* using enhanced for loop i.e. For-each loop. | |
* | |
* @author Gaurav Kukade at coderolls.com | |
* |
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.gaurav.ExProject.ArrayList; | |
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* A java program to iterate through arraylist | |
* using the basic for loop. | |
* | |
* @author Gaurav Kukade at coderolls.com |
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
import org.apache.commons.lang3.ArrayUtils; | |
/** | |
* A java program to check if an array contains a value suing the | |
* Apache common lang library's ArrayUtils.contains() method | |
* | |
* @author Gaurav Kukade at coderolls.com | |
* | |
*/ | |
public class ArrayUtilsExample { |
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
/** | |
* A Java program to check if a primitive array contains a primitive value | |
* using the Java 8 Stream API | |
* | |
* @author Gaurav Kukade at coderolls.com | |
* | |
*/ | |
public class CheckInPrimitiveArrayUsingStream { | |
public static void main(String[] args) { |
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
/** | |
* A Java program to check if a primitive array contains a primitive value | |
* | |
* @author Gaurav Kukade at coderolls.com | |
* | |
*/ | |
public class CheckInPrimitiveArray { | |
public static void main(String[] args) { | |