class ArrowLineLayer extends KujakuLayer {

    @Override
    public void updateFeatures(@NonNull FeatureCollection featureCollection) {
        if (this.builder.featureConfig.featureCollection != null) {
            this.builder.featureConfig.featureCollection = featureCollection;
        }

        if (this.builder.featureConfig.featureFilterBuilder != null) {
            this.builder.featureConfig.featureFilterBuilder.setFeatureCollection(featureCollection);
        }

        if (lineLayer != null) {
            GenericAsyncTask genericAsyncTask = new GenericAsyncTask(new AsyncTaskCallable() {
                @Override
                public Object[] call() throws Exception {
                    FeatureCollection filteredFeatureCollection = filterFeatures(builder.featureConfig, builder.sortConfig);
                    FeatureCollection arrowHeadFeatures;

                    if (builder.sortConfig != null) {
                        FeatureCollection sortedFeatureCollection = sortFeatures(filteredFeatureCollection, builder.sortConfig);
                        LineString arrowLine = calculateLineString(sortedFeatureCollection);
                        arrowHeadFeatures = generateArrowHeadFeatureCollection(arrowLine);

                        return new Object[]{arrowLine, arrowHeadFeatures};
                    } else if (builder.oneToManyConfig != null) {
                        MultiLineString arrowLine = calculateMultiLineString(filteredFeatureCollection, builder.oneToManyConfig);
                        arrowHeadFeatures = generateArrowHeadFeatureCollection(arrowLine);

                        return new Object[]{arrowLine, arrowHeadFeatures};
                    } else {
                        throw new IllegalArgumentException("SortConfig & OneToManyConfig not available to draw the line layer");
                    }
                }
            });
            genericAsyncTask.setOnFinishedListener(new OnFinishedListener() {
                @Override
                public void onSuccess(Object[] objects) {
                    Geometry arrowLine = (Geometry) objects[0];
                    FeatureCollection arrowHeadFeatures = (FeatureCollection) objects[1];

                    arrowHeadSource.setGeoJson(arrowHeadFeatures);
                    lineLayerSource.setGeoJson(arrowLine);
                }

                @Override
                public void onError(Exception e) {
                    Log.e(TAG, Log.getStackTraceString(e));
                }
            });

            genericAsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
        }
    }

    private  ArrowLineLayer(@NonNull Builder builder);

}