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 interface Api { | |
// constant declarations | |
int CAFEBABE = 0xCAFEBABE; | |
// abstract methods | |
void foo(int data); | |
void bar(int data); | |
// default methods |
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 VisibilityTest { | |
interface I { | |
private void foo(int x) {} | |
private void bar(int x) {} | |
} | |
interface J extends I { | |
void foo(int x); // Valid: public abstract method with the same signature as a private method in super type is allowed. | |
default void bar(int x) {} // Valid: public default method with the same signature as a private method in super type is allowed. | |
} |
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 NameClashTest { | |
interface I { | |
void foo(int x); | |
private I foo() { | |
return null; | |
} | |
private void foo(int x) {} // Invalid: method foo(int) is already defined in interface NameClashTest.I | |
} |
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
@Path("/sakila") | |
public class SakilaResource { | |
@Context | |
private SearchContext searchContext; | |
List<Actor> actors = new ArrayList<Actor>(); | |
List<Film> films = new ArrayList<Film>(); | |
List<Rental> rentals = new ArrayList<Rental>(); |
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 SakilaSearchTest { | |
static Server server; | |
@BeforeClass | |
public static void setUp() { | |
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean(); | |
sf.setResourceClasses(SakilaResource.class); | |
sf.getInInterceptors().add(new LoggingInInterceptor()); | |
sf.getOutInterceptors().add(new LoggingOutInterceptor()); |
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 oscon.java.parallel; | |
import extra166y.Ops; | |
import extra166y.ParallelArray; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
public class GoingParallelInJava { |
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
Factory factory = Factory.makeInstance(); | |
EngineHelper helper = factory.makeEngineHelper(); | |
FlowChart flowChart = helper.makeFlowChart("SCP Action Example"); | |
SCPActionFactory scpActionFactory = (SCPActionFactory) flowChart.makeFactory("SCPActionFactory"); | |
SCPAction downloadFile = scpActionFactory.makeSCPAction("SCP Download"); | |
downloadFile.setHost("arul-ubuntu"); | |
downloadFile.setUsername(System.getProperty("user.name")); | |
downloadFile.setDownload(true); | |
downloadFile.setRemotePath("Downloads/jdk-1_5_0_22-linux-i586.bin"); | |
downloadFile.setLocalPath("/tmp/"); |
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() { | |
test(var a, [b = 54]) { | |
print(b); | |
} | |
test(10); | |
} |
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 FunctionTest { | |
FunctionTest(this.myFunc); | |
Function myFunc; | |
num run(num n) { | |
return myFunc(n); | |
} | |
} | |
main() { | |
var square = (aNumber) => aNumber * aNumber; | |
var result = new FunctionTest(square).run(5); |
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() { |
OlderNewer