public static void insertTopic(List<ITopic> topics,ITopic topic){
  if (topics == null || topics.size() == 0 || topics.contains(topic)) {
    return;
  }
  List<ITopic> allTopics=MindMapUtils.getAllTopics(topic.getOwnedSheet(),true,true);
  int index=allTopics.indexOf(topic);
  for (int i=index + 1; i < allTopics.size(); i++) {
    ITopic t=allTopics.get(i);
    if (topics.contains(t)) {
      topics.add(topics.indexOf(t),topic);
      return;
    }
  }
  topics.add(topic);
}

public static void insertTopic ( List < ITopic > topics , ITopic topic ) { if ( topics == null || topics . size ( ) == 0 || topics . contains ( topic ) ) { return ; } List < ITopic > allTopics = MindMapUtils . getAllTopics ( topic . getOwnedSheet ( ) , true , true ) ; int index = allTopics . indexOf ( topic ) ; for ( int i = index + 1 ; i < allTopics . size ( ) ; i ++ ) { ITopic t = allTopics . get ( i ) ; if ( topics . contains ( t ) ) { topics . add ( topics . indexOf ( t ) , topic ) ; return ; } } topics . add ( topic ) ; }
if topics contain topic , return ; else insert topic into list < topics > at the proper position .
