Thursday, June 14, 2018

Automatic Switch Between LAN & Wifi in Windows 10


Steps to switch between LAN and Wifi Automatically.

1.       Go to Control Panel -> Network & Sharing Centre  -> Change Adapter Settings
2.       Git ‘Alt’ button to get Menu items
3.       Click Advanced -> Advanced Settings
4.       Change the order like below.
5.       Click Ok.
Note : First preference will be LAN if connected.


Wednesday, June 13, 2018

First Non Repeating Character Using Java 8

Hi Friends,

In this post, we will see the program for FirstNonRepeatingCharacter in java.

package com.raj.programs;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;

public class FirstNonRepeatingCharacter {

static Character getFirstNonRepeatingCharacter(String input) {
Map<Character, Integer> table = new LinkedHashMap<>(input.length());

input.chars() // IntStream
.mapToObj(c -> (char) c) // converting into char
.forEach(ch -> table.put(ch, table.containsKey(ch) ? table.get(ch) + 1 : 1)); // putting in map

return table.entrySet().stream() // getting stream from map entries
.filter(entry -> entry.getValue() == 1) // getting only the entries which presented only one time
.map(Entry::getKey) // getting the entry keys alone
.findFirst() // getting first element in the key list
.orElse(null); // If none found, null will be returned
}

public static void main(String[] args) {
System.out.println("FirstNonRepeatingCharacter :"+FirstNonRepeatingCharacter.getFirstNonRepeatingCharacter("ABCABD"));
}

}


Output:
FirstNonRepeatingCharacter :C

First Recurring Character Java Program

Hi Folks,

Below the source code for FirstRecurringCharacter in java.

package com.raj.programs;

import java.util.Hashtable;

public class FirstRecurringCharacter {

public static String firstRecurring(String inputString) {

Hashtable<String, String> table =  new Hashtable<>(inputString.length());

for(char c : inputString.toCharArray()) {
if(table.containsKey(String.valueOf(c))){
System.out.println("First Recurring character is : "+c);
return String.valueOf(c);
}else {
table.put(String.valueOf(c), String.valueOf(c));
}
}
System.out.println("Not found");
return null;
}

public static void main(String[] args) {
FirstRecurringCharacter.firstRecurring("ABCDEFA");
FirstRecurringCharacter.firstRecurring("ABCDEF");
}

}

உப்பு மாங்காய்

சுருக்குப்பை கிழவி. சுருக்கங்கள் சூழ் கிழவி. பார்க்கும் போதெல்லாம் கூடையுடனே குடியிருப்பாள். கூடை நிறைய குட்டி குட்டி மாங்காய்கள். வெட்டிக்க...