Here's an example of something that was tagged as example code. I'm wondering what makes it example code as sometimes we have to change strings/variable names that exist in our production code.
I understand that several properties and variables are not defined. What if the code were submitted like this instead?
Vector<string> tableType1List ... /* holds table types */
Vector<string> tableType2List ... /* holds table types */
public string getTableType (string typeOfTable, string fileName)
{
if (typeOfTable.equals("STRING1")) {
for (String type1Table : tableType1List) {
if (fileName.contains(type1Table)) {
tableType= "STRING1";
return tableType;
}
}
} else if (typeOfTable.equals("STRING2")) {
for (String type2Table : tableType2List) {
if (fileName.contains(type2Table)) {
tableType= "STRING2";
return tableType;
}
}
} else if (typeOfTable.equals("STRING3")) {
if (fileName.contains("String3")) {
tableType= "STRING3";
return tableType;
}
} else if (typeOfTable.equals("STRING4")) {
if (fileName.contains("String4")) {
tableType= "STRING4";
return tableType;
}
}
}
Is the difference between what was posted and my example enough to make it not be flagged as "example code"? Or would I also run into this issue? Personally I think my example should not be deemed example code as it can run by itself. I specifically did not add values to the vectors to show the irrelevance of the actual values in the method, but if that would be your sole reason for deeming it example code, please mention that but in the review context just assume that I'm doing that.