I want to include this java code in my blog (this is with the enclosing pre's):
<pre class="prettyprint">
public Vector<Instruction> decodeTree(Tree<String> gene) {
Vector<Instruction> ret = new Vector<Instruction>();
ret.add(decodeString(gene.getValue()));
Vector<Tree<String>> currentLayer = gene.getChildren();
Vector<Tree<String>> nextLayer = new Vector<Tree<String>>();
for(int i=0; i<currentLayer.size(); i++) {
for(Tree<String> t: currentLayer.get(i).getChildren()) {
nextLayer.add(t);
}
}
</pre>
But because it has several angle brackets, Blogger goes in and autocompletes all the inferred tags, transforming that chunk into the following:
<pre class="prettyprint">public Vector<instruction> decodeTree(Tree<string> gene) {
Vector<instruction> ret = new Vector<instruction>();
ret.add(decodeString(gene.getValue()));
Vector<tree tring="">> currentLayer = gene.getChildren();
Vector<tree tring="">> nextLayer = new Vector<tree tring="">>();
for(int i=0; i<currentlayer .size="" for="" i="" ree="" tring=""> t: currentLayer.get(i).getChildren()) {
nextLayer.add(t);
}
}
</currentlayer></tree></tree></tree></instruction></instruction></string></instruction></pre>
Which then shows up as:
public Vector decodeTree(Tree gene) {
Vector ret = new Vector();
ret.add(decodeString(gene.getValue()));
Vector> currentLayer = gene.getChildren();
Vector> nextLayer = new Vector>();
for(int i=0; i t: currentLayer.get(i).getChildren()) {
nextLayer.add(t);
}
}
Which is different from the code I'm trying to present. I think the problem originates in the html confusing my things with angle brackets with HTML tags. Is there a way I could get the parser to ignore all that? I tried changing all the angle brackets to > and < and got the following output:
public Vector<Instruction> decodeTree(Tree<String> gene) {
Vector<Instruction> ret = new Vector<Instruction>();
ret.add(decodeString(gene.getValue()));
Vector<Tree<String>> currentLayer = gene.getChildren();
Vector<Tree<String>> nextLayer = new Vector<Tree<String>>();
for(int i=0; i<currentLayer.size(); i++) {
for(Tree<String> t: currentLayer.get(i).getChildren()) {
nextLayer.add(t);
}
}