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 foobar { | |
foo() { | |
return '00'; | |
} | |
bar() { | |
return 7; | |
} | |
} | |
main() { |
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
main() { | |
var lst = new List<num>(2); | |
lst[0] = 2; | |
lst[1] = 'two'; | |
for (var e in lst) { | |
print(e); | |
} | |
} |
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
main() { | |
Map<String, int> map = { | |
'one': 1, | |
'two': 2, | |
'twelve': 12}; | |
void iterateMapEntry(key, value) { | |
map[key] = value; | |
print('$key:$value');//string interpolation in action | |
} |
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
main() { | |
List<String> list = new List<String>(); | |
list.add('one'); | |
list.add('two'); | |
list.add('twelve'); | |
list.forEach((element) => print(element)); | |
Set<String> set = Set.from(list); | |
set.forEach((element) => print(element)); | |
} |
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
main() { | |
var aMap = const {'a':4,'b':5,'c':6,'d':7}; | |
aMap.getKeys().some((var key) { | |
print('$key'); | |
if (key == 'b') { | |
return true; // early exit | |
} | |
}); | |
print('See?, no "c" nor "d"'); | |
} |
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
/* | |
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. | |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
* | |
* This code is free software; you can redistribute it and/or modify it | |
* under the terms of the GNU General Public License version 2 only, as | |
* published by the Free Software Foundation. Oracle designates this | |
* particular file as subject to the "Classpath" exception as provided | |
* by Oracle in the LICENSE file that accompanied this code. | |
* |
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
//Line # 68-75 https://gist.github.com/1303091 | |
/** | |
* In case you were wondering this method is called by java -version. | |
* Sad that it prints to stderr; would be nicer if default printed on | |
* stdout. | |
*/ | |
public static void print() { | |
print(System.err); | |
} |
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.glassfish.jersey.media.json.JsonJacksonModule; | |
import org.glassfish.jersey.server.Application; | |
import org.glassfish.jersey.server.ResourceConfig; | |
import org.glassfish.jersey.test.JerseyTest; | |
import org.glassfish.jersey.test.TestProperties; | |
import org.glassfish.jersey.test.spi.TestContainer; | |
import org.junit.Test; | |
import javax.ws.rs.core.MediaType; |
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.sun.jersey.api.client.Client; | |
import com.sun.jersey.api.client.ClientResponse; | |
import com.sun.jersey.api.client.WebResource; | |
import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter; | |
import com.sun.jersey.api.client.filter.LoggingFilter; | |
import com.sun.jersey.multipart.FormDataBodyPart; | |
import com.sun.jersey.multipart.FormDataMultiPart; | |
import javax.ws.rs.core.MediaType; | |
import java.util.HashMap; |
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.sun.jersey.api.client.Client; | |
import com.sun.jersey.api.client.ClientResponse; | |
import com.sun.jersey.api.client.WebResource; | |
import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter; | |
import com.sun.jersey.api.client.filter.LoggingFilter; | |
import com.sun.jersey.multipart.FormDataBodyPart; | |
import com.sun.jersey.multipart.FormDataMultiPart; | |
import com.sun.jersey.multipart.file.FileDataBodyPart; | |
import javax.ws.rs.core.MediaType; |