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
object FirstExercise{ | |
def main(args:Array[String]) = { | |
val names = List("John", "Jack","Jill","Sam","William") | |
println(names) | |
val names2 = names.map{key => (key,key.length)} | |
println(names2) | |
} | |
} |
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
[ | |
{ | |
"id":"6253282", | |
"name":"Twitter API", | |
"screen_name":"twitterapi", | |
"url":"http:\/\/dev.twitter.com", | |
"followers_count":1004641, | |
"friends_count":33, | |
"favourites_count":24, | |
"statuses_count":3277 |
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 com.google.gson.Gson; | |
import com.google.gson.JsonArray; | |
import com.google.gson.JsonElement; | |
import com.google.gson.JsonParser; | |
import com.google.gson.stream.JsonReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.net.URL; | |
import java.net.URLConnection; |
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.io.IOException; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
/** | |
* Created by IntelliJ IDEA. | |
* User: mohamed | |
* Date: 1/5/12 | |
* Time: 8:49 PM |
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.io.IOException; | |
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* | |
* @author mohamed | |
*/ | |
public class NNAlgorithm { |
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
5.1,3.5,1.4,0.2,Iris-setosa | |
4.9,3.0,1.4,0.2,Iris-setosa | |
4.7,3.2,1.3,0.2,Iris-setosa | |
4.6,3.1,1.5,0.2,Iris-setosa | |
5.0,3.6,1.4,0.2,Iris-setosa | |
5.4,3.9,1.7,0.4,Iris-setosa | |
4.6,3.4,1.4,0.3,Iris-setosa | |
5.0,3.4,1.5,0.2,Iris-setosa | |
4.4,2.9,1.4,0.2,Iris-setosa | |
4.9,3.1,1.5,0.1,Iris-setosa |
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.*; | |
public class EnhancedCollections{ | |
public static void main(String[] args){ | |
List<Integer> counts = new ArrayList<Integer>(); | |
for(int i=1;i <= 10; i++){ | |
counts.add(i); | |
} | |
//Using external iterators | |
System.out.println("Using external iterator"); |
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.io.IOException; | |
import java.nio.file.DirectoryStream; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
public class DirectoryFilterTest { | |
public static void main(String[] args) { | |
Path basePath = Paths.get("D:/tests"); |
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
public class JsonParser extends Parser { | |
public JsonParser(Parser successor){ | |
this.setSuccessor(successor); | |
} | |
@Override | |
public void parse(String fileName) { | |
if ( canHandleFile(fileName, ".json")){ | |
System.out.println("A JSON parser is handling the file: "+fileName); |
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
public class CsvParser extends Parser { | |
public CsvParser(Parser successor){ | |
this.setSuccessor(successor); | |
} | |
@Override | |
public void parse(String fileName) { | |
if ( canHandleFile(fileName, ".csv")){ | |
System.out.println("A CSV parser is handling the file: "+fileName); |
OlderNewer