Java security engineering
Inventory a transitive component
A three-node synthetic graph shows why indirect dependencies matter. A production inventory needs versions, artifact identities, completeness and bounded traversal.
Formal Syntax & Structure
java syntaxjava
walk(component, graph, visited)Working Example
Example Snippetjava
public class Main { static void walk(String id,java.util.Map<String,java.util.List<String>> graph,java.util.Set<String> found) { if(!found.add(id)) return; for(String next:graph.getOrDefault(id,java.util.List.of())) walk(next,graph,found); } public static void main(String[] args) throws Exception { var graph=java.util.Map.of("app",java.util.List.of("api"),"api",java.util.List.of("codec"),"codec",java.util.List.<String>of()); var found=new java.util.TreeSet<String>(); walk("app",graph,found); System.out.println(found); }}