Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





Java - Code Samples

 Sample 1. Code Sample / Example / Snippet of org.apache.bcel.util.InstructionFinder

    public void testSearch() {

final InstructionList il = new InstructionList();

il.append(new ILOAD(1));

il.append(new ILOAD(2));

il.append(new IADD());

il.append(new ISTORE(3));

final InstructionFinder finder = new InstructionFinder(il);



final Iterator<?> it = finder.search("ILOAD IADD", il.getInstructionHandles()[0], null );

final InstructionHandle[] ihs = (InstructionHandle[])it.next();

assertEquals(2, ihs.length);

assertEquals(ihs[0].getInstruction(), new ILOAD(2));

assertEquals(ihs[1].getInstruction(), new IADD());

}


   Like      Feedback      org.apache.bcel.util.InstructionFinder



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner