Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Arul Dhesiaseelan aruld

🎯
Focusing
View GitHub Profile
View Api.java
public interface Api {
// constant declarations
int CAFEBABE = 0xCAFEBABE;
// abstract methods
void foo(int data);
void bar(int data);
// default methods
@aruld
aruld / VisibilityTest.java
Created Mar 21, 2015
cannot reduce visibility of private methods
View VisibilityTest.java
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.
}
View NameClashTest.java
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
}
View SakilaResource.java
@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>();
View SakilaSearchTest.java
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());
View GoingParallelInJava
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 {
@aruld
aruld / SCPActionTest
Created Aug 12, 2011
SCPAction example
View SCPActionTest
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/");
@aruld
aruld / defaults.dart
Created Oct 19, 2011
Dart optional defaults
View defaults.dart
main() {
test(var a, [b = 54]) {
print(b);
}
test(10);
}
View functiontest.dart
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);
@aruld
aruld / foobar.dart
Created Oct 19, 2011
My first Dart script
View foobar.dart
class foobar {
foo() {
return '00';
}
bar() {
return 7;
}
}
main() {