Question: Zip and Pad Lists
Write a function named zipAndPad() that takes two lists of potentially different lengths as input. The function should return a list of pairs (as lists), where each pair consists of one element from each input list. If one list is longer than the other, pad the missing elements with an empty string.
Examples:
cust_id = { 1, 2, 3 };
cust_name = { "sam", "den", "lenny" };
customers = { {1,"sam"}, {2,"den"}, {3, "lenny"} };
Keep reading with a 7-day free trial
Subscribe to Java Newsletter to keep reading this post and get 7 days of free access to the full post archives.