Posts

Showing posts from December 4, 2018

How to create a recursive method in Apex which takes a dot notation string and convert it into Hierarchical...

Image
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty{ margin-bottom:0; } up vote 7 down vote favorite 1 I'm trying to create a utility class/method where a certain method will accept a list of Strings - each string will be constructed as follows: "Root.Parent.Child... N" This string can be N long (or basically holds infinite number of parts). Each Part of the String (parts are the split string by dot) is intended to be a Json Object. For Example: //sample data String rec1 = 'Root.Parent.FirstChild'; String rec2 = 'Root.Parent.FirstChild2'; String rec3 = 'Root.Parent2.Child'; String rec4 = 'Root.Parent2.Child2'; String fullPathsList = new List<String>{ rec1,rec2,rec3,rec4 }; //should create as many ma...