philadelphia-core: Add FIXMessage#findIndex method to lookup index of tag
@@ -88,6 +88,22 @@ public class FIXMessage {
return null;
}
+ /**
+ * Get the index of the first instance of a field with the specified tag.
+ *
+ * @param tag the tag
+ * @return the index or -1 if there are no instances
+ * of a field with the specified tag
+ */
+ public int findIndex(int tag) {
+ for (int i = 0; i < count; i++) {
+ if (fields[i].getTag() == tag)
+ return i;
+ }
+
+ return -1;
+ }
+
/**
* Add a field.
*
