public static void sortNanoPostsOpsByTimestamp(ArrayList<NanoPost> nanoposts) {
        ArrayList<NanoPost> nonOps = new ArrayList<>();

        // Remove from main list all non-ops and save removed non-ops in other list
        for (Iterator<NanoPost> i = nanoposts.listIterator(); i.hasNext();) {
            NanoPost item = i.next();
            
            if (!item.isOpPost()) {
                nonOps.add(item);
                
                i.remove();
            }   
        }      
        
        // Sorting only OP-posts remaining
        Collections.sort(nanoposts, new Comparator<NanoPost>(){
            @Override
            public int compare(NanoPost p1, NanoPost p2) {
                if (p1.isOpPost() && p2.isOpPost()) {
                    
                    int ts1 = p1.getPostTimestamp();
                    int ts2 = p2.getPostTimestamp();
                    
                    // Checking bump condition
                    // Last child post in one thread is newer than last child post in other thread
                    NanoPost p1Bump = p1.getLastChildPost();
                    NanoPost p2Bump = p2.getLastChildPost();     
                    
                    if (p1Bump != null) {
                        ts1 = p1Bump.getPostTimestamp();
                    }

                    if (p2Bump != null) {
                        ts2 = p2Bump.getPostTimestamp();
                    }
           
                    return ts2 - ts1;
                } else {
                    return 0;
                }
            }
        });  
        
        // Append non-ops posts to the end
        nanoposts.addAll(nonOps);
    }