ingest(Track track). Validate null, ID, lat/lon bounds, and upsert into map.
Complete the ingest(Track track) method. Sensor reports arrive continuously from radar antennas. Your method must validate incoming telemetry before it touches the tactical wargaming state.
null track references immediately.null or empty string trackId.[-90.0, +90.0] degrees.[-180.0, +180.0] degrees.trackId exists, overwrite previous telemetry (update).trackId is new, insert into collection (create).HashMap for O(1) ingestion lookup. In a live multi-threaded simulation loop, I'd use ConcurrentHashMap."| Concept | C# (Your Natural Instinct) | Java (Interview Target) |
|---|---|---|
| Map / Dictionary Lookup | map[key] = val;map.ContainsKey(key) |
map.put(key, val);map.containsKey(key) |
| Map Safe Get | map.GetValueOrDefault(k, def) |
map.getOrDefault(k, def) |
| List Size | list.Count |
list.size() |
| String Checks | string.IsNullOrEmpty(s) |
s == null || s.isEmpty() |
| Inheritance | class Radar : Sensor, ITrackable |
class Radar extends Sensor implements Trackable |
| PriorityQueue | PriorityQueue<T,P> (.NET 6+) |
new PriorityQueue<>((a,b) -> Double.compare(a.getTti(), b.getTti())); |
| Console Print | Console.WriteLine(...) |
System.out.println(...) |
| Constants | const int MAX = 100; |
final int MAX = 100; |