[FREE] ListUtilz Extension - A Powerful Lists Management Extension

ListUtilz Extension

An extension for MIT App Inventor 2.
Powerful list utilities extension to work with lists with multiple functions. Developed by The K Studio.


Download: v5 com.thekstudio.listutilz.aix (15.2 KB)


:memo: Specifications

:package: Package: com.thekstudio.listutilz
:floppy_disk: Size: 15.24 KB
:iphone: Minimum API Level: 7
:date: Updated On: 2025-06-16T18:30:00Z
:computer: Built & documented using: v3.1.0

Events:

ListUtilz has total 2 events.

ListFiltered

ListFiltered_Event

Event triggered when a list is filtered. Returns the filtered list and the indices of filtered items.

Parameter Type
filteredList list
filteredIndices list

SortedListAtoZ

SortedListAtoZ_Event

Event triggered when a list is sorted alphabetically.

Parameter Type
sortedList list
sortedIndices list

Methods:

ListUtilz has total 30 methods.

ReverseList

ReverseList_Method

Reverses a given list.

  • Return type: list
Parameter Type
list list

GetList1toN

GetList1toN_Method

Get integer list from 1 to N in increasing order.

  • Return type: list
Parameter Type
n number

GetRandomList1toN

GetRandomList1toN_Method

Get integer list from 1 to N in random order.

  • Return type: list
Parameter Type
n number

GetDuplicateItems

GetDuplicateItems_Method

Finds duplicates in a given list and returns a new list containing only the duplicate items.

  • Return type: list
Parameter Type
list list

GetMaximumNumber

GetMaximumNumber_Method

Get maximum number from the given integer list.

  • Return type: number
Parameter Type
list list

GetMinimumNumber

GetMinimumNumber_Method

Get minimum number from the given integer list.

  • Return type: number
Parameter Type
list list

GetLastItem

GetLastNItems_Method

Get last item from the given list.

  • Return type: any
Parameter Type
list list

CompareLists

CompareLists_Method

Compares two given lists and returns true if they match, false otherwise.

  • Return type: boolean
Parameter Type
list1 list
list2 list

ListToJSON

ListToJSON_Method

Converts a given list to a JSON string.

  • Return type: text
Parameter Type
list list

GetDistinctList

GetDistinctList_Method

Returns a new list containing the distinct (unique) elements from the given list.

  • Return type: list
Parameter Type
list list

ShuffleList

ShuffleList_Method

Returns a new list with the elements randomly shuffled.

  • Return type: list
Parameter Type
list list

GetListUnion

GetListUnion_Method

Returns a new list containing the union of multiple lists (combines the elements from all input lists, removing any duplicates).

  • Return type: list
Parameter Type
lists list

GetListOccurrences

GetListOccurrences_Method

Returns the number of occurrences (duplicates) of an item in given list.

  • Return type: number
Parameter Type
list list
item any

GetListOccurrencesIndex

GetListOccurrencesIndex_Method

Returns a list of indices at which the given item occurs in the list.

  • Return type: list
Parameter Type
list list
item any

GetListSlice

GetListSlice_Method

Returns a slice of the given list from the start index (inclusive) to the end index (exclusive).

  • Return type: list
Parameter Type
list list
startIndex number
endIndex number

SortIntegers

SortIntegers_Method

Sorts a given list of integers with negative values first in ascending order.

  • Return type: list
Parameter Type
list list

RemoveItems

RemoveItems_Method

Removes items from the given list within the specified range and returns the modified list.

  • Return type: list
Parameter Type
list list
startIndex number
endIndex number

SortListAtoZ

SortListAtoZ_Method

Sorts a given list alphabetically.

  • Return type: list
Parameter Type
list list
ignoreCase boolean

GetListIntersection

GetListIntersection_Method

Returns a new list containing the intersection of multiple lists.

  • Return type: list
Parameter Type
lists list

GetFilteredList

GetFilteredList_Method

Filters a given list based on a keyword with case sensitivity control.

  • Return type: list
Parameter Type
list list
keyword text
caseSensitive boolean

FilterList

FilterList_Method

Filters a given list based on a keyword with case sensitivity control and return filtered list in ListFiltered event.

Parameter Type
list list
keyword text
caseSensitive boolean

FilterListAsync

FilterListAsync_Method

Filters a given list based on a keyword with case sensitivity control and return filtered list in ListFiltered event.

Parameter Type
list list
keyword text
caseSensitive boolean

SortStringIntegers

SortStringIntegers_Method

Sorts integers within given list of strings with negative values first in ascending order.

  • Return type: list
Parameter Type
list list

GetFilteredListWithKeywords

GetFilteredListWithKeywords_Method

Filters a given list based on a list of keywords with case sensitivity control.

  • Return type: list
Parameter Type
list list
keywords list
caseSensitive boolean

GetFirstNItems

GetFirstNItems_Method

Get the first n items from the given list.

  • Return type: list
Parameter Type
list list
n number

GetLastNItems

GetLastNItems_Method

Get the last n items from the given list.

  • Return type: list
Parameter Type
list list
n number

SortListAtoZAsync

SortListAtoZAsync_Method

Sorts a given list alphabetically.

Parameter Type
list list
ignoreCase boolean

SortByCategory

SortByCategory_Method

Sorts elements from list1 based on the category specified by keyword from list2.

  • Return type: list
Parameter Type
list1 list
list2 list
keyword text

GetListPermutations

GetListPermutations_Method

Get all permutations of the given list.

  • Return type: list
Parameter Type
list list

GetListCombinations

GetListCombinations_Method

Get all combinations of the given size from the list.

  • Return type: list
Parameter Type
list list
combinationSize number

Instructions to use extension


Use this block to sort a given list alphabetically. It also considers integers and sort in natural sorting order.

image
Use this block to sort given list of integers in increasing order. No matter the list item is a single digit or multiple digit. It also supports negative values.

image
Reverses the given list.


Search in a given list with a specific keyword and get all items containing the given keyword. Useful for filtering list or making search system.

image
Shuffles the given list.

image
Returns duplicate items as a list.


GetOccurrences block will return the count of item in a list (how many times it is in the list) and index block will return the indices of these items.


Get integer list from 1 to given n


Get minimum and maximum number from a given integer list.

image
Get last list item

image
Converts a given list into JSON string.


Compare given two lists and returns true if matches else false.

image
Returns a new list containing the union of two lists (combines the elements from both input lists, removing any duplicates).

image
Returns a new list containing the distinct (unique) elements from the given list.


Returns a new list containing the intersection of given lists (a new list containing the common elements present in all input lists). Accepts multiple lists.

image
Returns a slice (part) of the given list from the start index (inclusive) to the end index (exclusive).

image
RemoveItems from start index to end index and return filtered list.

CHANGE LOG

Added a new block FilterListAsync to filter list asynchronously and return filtered list as well as their indices.
image

Added function to Sort list A to Z async and returns sorted list along with sorted indices.

image

12 Likes

Thanks for the extension, but most of these blocks do the same thing as the built-in blocks in ai2...a few of your blocks do pretty much the same thing, so it makes no sense to double them, like getList1toN and getlistSlice.

Only few blocks do the same thing as of inbuilt blocks. But most of the functions are added to make the work easier, I have added them to make this extension more useful and may someone gets it useful specially new users.

This makes sense I think!

1 Like

Maybe you should choose a different name for your extension since one already exists:

2 Likes

Hmm, agree but now let it be as this requires many changes in code as well as here.

Anyways original ListUtils extension has only few functions.

grafik

grafik

2 Likes

Are these from my extension? my extension dont have sort list with sort order block.

I do have SortListAtoZ block and working fine.

image

it's from another extension with same name. That's why @Anke ask you to change to another name.

2 Likes

Ahh, ok I got it. I will make some changes. Thanks.

Yes, the first one (and you should actually know that yourself :wink:).

1 Like

I got confused about second block.

I have updated the name and topic.

I'm sorry, I hate to break it to you, but almost every single block in this extension can be replicated with built-in blocks. Here is my approach in some of the blocks, there are still more that I haven't tried but can be replicated. Still, nice effort. (gave a like)

2 Likes

I agree, most of the things can be done without extension, but the only difference is extension makes it easier in few blocks as inbuilt blocks need some complicated logic and for pro Koders like us don't need extension.

Anyone who find this useful can use. :sweat_smile:

I can see your efforts in above blocks!

If any single block from my extension finds useful for anyone, that's enough for me. At least it makes me feel I have not wasted my time. :wink:

5 Likes

I like a well defined function signature.

I might copy your interfaces in blocks, while continuing to avoid extensions in my samples.

UPDATED

  1. Filter List functions updated to return result directly as well as in event.
  2. GetListIntersection function now accepts multiple lists.
  3. GetListUnion function now accepts multiple lists.
  4. Added new block RemoveItems.

Updated v2

4 Likes

Added 2 new blocks.

Get First n items and Get last n items to get first specified number of items and last specified number of items from the given list respectively.

Updated v4

That's a good extension.
Can you add the function that I can give certain items a category and then sort by these categories in the listviewer?

Thanks in advance

Provide an example.