/**
         * Takes in a list of autofill hints (`autofillHints`), usually associated with a View or set of
         * Views. Returns whether any of the filled fields on the page have at least 1 of these
         * `autofillHint`s.
         */
        public bool HelpsWithHints(List <String> autofillHints)
        {
            for (var i = 0; i < autofillHints.Count; i++)
            {
                if (HintMap.ContainsKey(autofillHints[i]) && !HintMap[autofillHints[i]].IsNull())
                {
                    return(true);
                }
            }

            return(false);
        }
 /// <summary>
 /// Takes in a list of autofill hints (`autofillHints`), usually associated with a View or set of
 /// Views. Returns whether any of the filled fields on the page have at least 1 of these
 /// `autofillHint`s.
 /// </summary>
 /// <returns><c>true</c>, if with hints was helpsed, <c>false</c> otherwise.</returns>
 /// <param name="autofillHints">Autofill hints.</param>
 public bool HelpsWithHints(List <string> autofillHints)
 {
     for (int i = 0; i < autofillHints.Count; i++)
     {
         var autofillHint = autofillHints[i];
         if (HintMap.ContainsKey(autofillHint) && !HintMap[autofillHint].IsNull())
         {
             return(true);
         }
     }
     return(false);
 }
        /**
         * Populates a {@link Dataset.Builder} with appropriate values for each {@link AutofillId}
         * in a {@code AutofillFieldMetadataCollection}.
         *
         * In other words, it constructs an autofill
         * {@link Dataset.Builder} by applying saved values (from this {@code FilledAutofillFieldCollection})
         * to Views specified in a {@code AutofillFieldMetadataCollection}, which represents the current
         * page the user is on.
         */
        public bool ApplyToFields(AutofillFieldMetadataCollection autofillFieldMetadataCollection,
                                  Dataset.Builder datasetBuilder)
        {
            var setValueAtLeastOnce = false;
            var allHints            = autofillFieldMetadataCollection.AutofillHints;

            for (var hintIndex = 0; hintIndex < allHints.Count; hintIndex++)
            {
                var hint = allHints[hintIndex];
                if (!autofillFieldMetadataCollection.AutofillHintsToFieldsMap.ContainsKey(hint))
                {
                    continue;
                }

                var fillableAutofillFields = autofillFieldMetadataCollection.AutofillHintsToFieldsMap[hint];
                for (var autofillFieldIndex = 0; autofillFieldIndex < fillableAutofillFields.Count; autofillFieldIndex++)
                {
                    if (!HintMap.ContainsKey(hint))
                    {
                        continue;
                    }

                    var filledAutofillField   = HintMap[hint];
                    var autofillFieldMetadata = fillableAutofillFields[autofillFieldIndex];
                    var autofillId            = autofillFieldMetadata.AutofillId;
                    var autofillType          = autofillFieldMetadata.AutofillType;
                    switch (autofillType)
                    {
                    case AutofillType.List:
                        int listValue = autofillFieldMetadata.GetAutofillOptionIndex(filledAutofillField.TextValue);
                        if (listValue != -1)
                        {
                            datasetBuilder.SetValue(autofillId, AutofillValue.ForList(listValue));
                            setValueAtLeastOnce = true;
                        }
                        break;

                    case AutofillType.Date:
                        var dateValue = filledAutofillField.DateValue;
                        if (dateValue != null)
                        {
                            datasetBuilder.SetValue(autofillId, AutofillValue.ForDate(dateValue.Value));
                            setValueAtLeastOnce = true;
                        }
                        break;

                    case AutofillType.Text:
                        var textValue = filledAutofillField.TextValue;
                        if (textValue != null)
                        {
                            datasetBuilder.SetValue(autofillId, AutofillValue.ForText(textValue));
                            setValueAtLeastOnce = true;
                        }
                        break;

                    case AutofillType.Toggle:
                        var toggleValue = filledAutofillField.ToggleValue;
                        if (toggleValue != null)
                        {
                            datasetBuilder.SetValue(autofillId, AutofillValue.ForToggle(toggleValue.Value));
                            setValueAtLeastOnce = true;
                        }
                        break;

                    case AutofillType.None:
                    default:
                        break;
                    }
                }
            }

            return(setValueAtLeastOnce);
        }