I am having a difficulty. I have retrieved a BasicDBList from database but now I want to iterate over the list but I cannot do it in it's BasicDBList format. So I want to ask that how can we cast BasicDBList to ArrayList of Java. Here is what I have tried.
DBCursor cursor1 = coll2.find();
DBObject main1 = cursor1.next();
ArrayList<String[]> ans = new ArrayList<String[]>();
ans.add(((String[]) main1.get("Data")));
but I am having following error
Exception in thread "main" java.lang.ClassCastException: com.mongodb.BasicDBList cannot be cast to [Ljava.lang.String;